CHAR movement

Posted By: 3run

CHAR movement - 02/23/11 13:06

I'm trying to make basic movement with PhysX, here is the example:
Code:
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysX.h>
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
function main()
{
	fps_max = 60;
	physX_open();
	video_set(800,600,32,0); 
	level_load("1.wmb"); 
	wait(3);
	sun_light = 0;
	pX_setgravity(vector(0,0,-10));
	sky_color.red = 1;
	sky_color.green = 1;
	sky_color.blue = 1;
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
#define absdist_x skill1
#define absdist_y skill2
#define absdist_z skill3
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
action hero()
{
	player = my;
	pXent_settype(my,PH_CHAR,PH_CONVEX);
	pXent_setskinwidth(my,0);
	while(1)
	{
		my.absdist_x = 10 * (key_w - key_s) * time_step;  
		my.absdist_y = 10 * (key_a - key_d) * time_step;
		result = c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME|USE_BOX);
		if(result > 10){my.absdist_z -= 0.1 * time_step;}
		else{my.absdist_z = 0;}
		vec_rotate(my.absdist_x,my.pan);
		my.pan -= 0.5 * mickey.x * time_step;
		pXent_movechar(my,my.absdist_x,my.pan,0); 		
		vec_set(camera.x,vector(my.x,my.y,my.z + 1200)); 
		camera.pan += ang(my.pan - camera.pan) * time_step * 0.8;
		camera.tilt = -90; 
		wait(1);
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
action pX_boX()
{
	pXent_settype(my,PH_RIGID,PH_BOX);
	pXent_setfriction(my,100);
	pXent_setskinwidth(my,0);
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

And here is the demo:
Download link
It works, but sometimes pushed crates, change they angle (PAN) after they stopped moving, what is wrong in my script?
Posted By: 3run

Re: CHAR movement - 02/23/11 19:47

No need to help me, fuck it!
Posted By: painkiller

Re: CHAR movement - 02/23/11 19:56

lol I guess it's just a PhysX problem, your code has nothing to do with that crates problem, maybe ccd
Posted By: 3run

Re: CHAR movement - 02/23/11 20:02

Thank u bro. Sorry for using bad words. Thing that kills me, is that no one response...
Posted By: Widi

Re: CHAR movement - 02/23/11 20:40

Please don't use this f*** word here in the forum!!! Thanks

From the Board Rules: - Do not post vulgar, racist, or insulting messages.


Posted By: 3run

Re: CHAR movement - 02/24/11 08:59

I already apologized for that. I was just really upset, sorry once again for using such words.
Posted By: 3run

Re: CHAR movement - 02/24/11 16:21

May be this all caused by PhysX driver? May be I need to update it or something?!
Posted By: 3run

Re: CHAR movement - 03/19/11 13:41

...
Posted By: 3run

Re: CHAR movement - 03/24/11 16:44

Glad you all helped me, thanks, I appreciate it...
Posted By: 3run

Re: CHAR movement - 03/24/11 16:45

...
Posted By: bk9iq

Re: CHAR movement - 03/25/11 01:54

This always happens and I am not sure why...
Check the last physx video I made...
http://www.youtube.com/watch?v=RLs7uuEATnk
go to 1:39 ((the very end)) and take a look at the boxes ... they change pan randomly...
I guess it's a bug.... I have everything updated including my drivers... and my video card is nVidia GTX 260

© 2024 lite-C Forums