Something strange happened, I can't move character via "pXent_moveglobal" anymore.
I just downloaded demo, I posted in first post, and it doesn't work...
Player changes it's position to the "nullvector" and doesn't move.
It moves if I do it like this: "dist.x += 10 * (key_w - key_s) * time_step;"
But if I do it like this, character passes throw level blocks (but collides with Ridig bodies).
Same happens if I use the example script you've posted link to.
I can move character normally with "pXent_movechar", but I'm getting problem with collisions again:
Example one:
Example two:
Here is example I tried to get working:
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysX.h>
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
action box_obj()
{
pXent_settype(my,PH_RIGID,PH_BOX);
}
action ball_obj()
{
pXent_settype(my,PH_RIGID,PH_SPHERE);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
var my_height;
VECTOR dist;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
action hero()
{
pXent_settype(my,PH_CHAR,PH_BOX);
wait(-1);
while(1)
{
DEBUG_VAR(my_height,30);
my_height = c_trace(my.x,vector(my.x,my.y,my.z-500), IGNORE_ME|USE_BOX);
if(my_height > 5){dist.z -= 1 * time_step;}else{dist.z = 0;}
dist.x = 10 * (key_d - key_a) * time_step;
dist.y = 0;
//pXent_moveglobal(my,dist,nullvector);
pXent_movechar(my,dist,nullvector,0);
vec_set(camera.x,vector(my.x,my.y - 700,my.z));
wait(1);
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
function main()
{
fps_max = 60;
physX_open();
level_load("test.WMB");
wait(3);
vec_set(camera.pan,vector(90,0,0));
pXent_setbodyflagall(NX_BF_FROZEN_POS_Y|NX_BF_FROZEN_PAN|NX_BF_FROZEN_ROLL,1);
pX_setgravity(vector(0,0,-9.81));
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
One more problem I found with making gravity for character, take a look at the screen:
At this position, gravity starts applying, cause trace returns far distance to ground.
But cause characters hull is BOX like, it doen't move down. Example is in script above.
Could you please check example I posted above, may be reason for all bugs I get with collusions is bad scripting?
Could you please give me an idea for workaround problem with gravity? Or may be in next update you'll make BOX shape for trace?
How do I change to "flat disk" shape for trace? I've never heard about it.