0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
CHAR movement
#360307
02/23/11 13:06
02/23/11 13:06
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I'm trying to make basic movement with PhysX, here is the example:
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
#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?
|
|
|
Re: CHAR movement
[Re: 3run]
#360376
02/23/11 19:56
02/23/11 19:56
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
lol I guess it's just a PhysX problem, your code has nothing to do with that crates problem, maybe ccd
Last edited by painkiller; 02/23/11 19:56.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: CHAR movement
[Re: 3run]
#360391
02/23/11 20:40
02/23/11 20:40
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
Please don't use this f*** word here in the forum!!! Thanks
From the Board Rules: - Do not post vulgar, racist, or insulting messages.
Last edited by Widi; 02/23/11 22:05.
|
|
|
Re: CHAR movement
[Re: 3run]
#364591
03/19/11 13:41
03/19/11 13:41
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
|
|
|
Re: CHAR movement
[Re: 3run]
#365227
03/24/11 16:45
03/24/11 16:45
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
|
|
|
|