Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
PhysX #336175
08/02/10 06:59
08/02/10 06:59
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I tried to make physic controlled player with PhysX, everything looks working great, but when I push physic objects (box for example) to the corner, object goes through the player (that is bug I guess). Here is the code I've made:
Code:
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

#include <default.c>
#include <ackphysx.h>

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

VECTOR dist;

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

var hero_move_speed = 8;
var hero_turn_speed = 10;

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function main()
{
	physX_open();
	fps_max = 60;
	level_load("1.WMB");
	wait(1);
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function camera_set()
{
	camera.tilt = -90;
	camera.pan = my.pan;
	vec_set(camera.x,vector(my.x,my.y,my.z + 800));
}

function handle_gravity()
{
	result = c_trace(my.x,vector(my.x,my.y,my.z - 1000),IGNORE_MODELS|USE_BOX);
	if(result > 10)
	{
		accelerate(dist.z,-10,1);
	}
	else
	{
		dist.z = -(result/1.2)+4;
		dist.z = clamp(dist.z,-4,4);
	}
}

function handle_movement()
{
	if(key_w)
	{
		dist.x = hero_move_speed * time_step;
	}
	else
	{
		if(key_s == 0)
		{
			dist.x = 0;			
		}
	} 
	if(key_s)		
	{
		dist.x = -hero_move_speed * time_step;
	}
	else
	{
		if(key_w == 0)
		{
			dist.x = 0;			
		}
	} 
	if(key_a)
	{
		dist.y = hero_move_speed * time_step;
	}
	else
	{
		if(key_d == 0)
		{
			dist.y = 0;			
		}
	} 
	if(key_d)
	{
		dist.y = -hero_move_speed * time_step;
	}
	else
	{
		if(key_a == 0)
		{
			dist.y = 0;			
		}
	}
	my.pan -= hero_turn_speed * mouse_force.x * time_step;
	vec_rotate(dist,my.pan);
}

action hero()
{
	player = my;
	pXent_settype(me,PH_CHAR,PH_BOX);
	while(1)
	{
		handle_gravity();
		handle_movement();
		pXent_movechar(me,dist,my.pan,0);
		camera_set();
		wait(1);
	}
}

action physX_box()
{
	pXent_settype(my,PH_RIGID,PH_BOX); 
	pXent_setmass(my,5);
	pXent_setfriction(my,5);
	pXent_setdamping (my,50,50); 
	pXent_setelasticity(my,0);
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

PANEL* gui = 
{
	layer = 1;
	digits(10,0,4,"Arial#24bi",1,player.pan);
	flags = SHOW;
}




Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: PhysX [Re: 3run] #336180
08/02/10 08:12
08/02/10 08:12
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
For using PhysX, read the PhysX FAQ in the manual - you can find many hints there. For instance, a typical collision problem is tunneling. When your objects are small and move fast, you'll need CCD.

A good source of help are also PhysX forums in the nVidia website.

If you still can't get your player to collide properly, contact Support and send them a small example level. They'll look into it.

Re: PhysX [Re: jcl] #336236
08/02/10 15:44
08/02/10 15:44
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Thank you, one more thing jcl, corners of the boxes pass trough each other, do I need to use CCD to fix that.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: PhysX [Re: 3run] #336346
08/03/10 08:37
08/03/10 08:37
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Either CCD, or setting a smaller skin width.

http://manual.3dgamestudio.net/pXent_setskinwidth.htm

Re: PhysX [Re: jcl] #338698
08/20/10 17:37
08/20/10 17:37
Joined: Oct 2007
Posts: 40
Switzerland
N
Nikozu86 Offline
Newbie
Nikozu86  Offline
Newbie
N

Joined: Oct 2007
Posts: 40
Switzerland
Helo,
is there a example for a simple plane using PhysX??
controls:
W,S = tilt
A,D, = roll
Y = soft Brake
X = speed up

i know how to do it with A7, but the new pX-stuff gives me an headache :-(

That`s all i need.


NO NEED ANYMORE! I Made it! :-)

Last edited by Nikozu86; 08/20/10 20:43.
Re: PhysX [Re: Nikozu86] #338849
08/22/10 04:27
08/22/10 04:27
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
It is still buggy frown Objects shakes when I push them to the walls, and I can't get to player proper gravity frown
Here is the quick demo I've made, may be I've made something wrong?
Download link


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: PhysX [Re: 3run] #338873
08/22/10 10:35
08/22/10 10:35
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
I had the same problem as you when I tried to use PhysX for my player movement, I couldn't get him go through stairs


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: PhysX [Re: painkiller] #340166
09/01/10 15:35
09/01/10 15:35
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
Maby you just make the player walk over smaler physical objeckts, becose its anyway not realistig that the little man pushes 5 times bigger things then himself...




Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1