Hi ,guys.
Here I met a problem about using physics system. Properly speaking, I want to add physics system to a entity to make it move as a real person and use some 'ph_/phent_' commands in the lite-c script. But when running the code the model could do nothing but perform the 'walk' animation in the original place or do some other unexpected things such as rolling forward. My code is like this:
action walking_guard()
{
guard = my;
guard.material = mat_model;
phent_settype(guard,PH_RIGID,PH_SPHERE);
phent_setmass(guard,3,PH_SPHERE);
phent_setfriction(guard,80);
phent_setelasticity(guard,40,40);
phent_setdamping(guard,100,50);
ph_setgravity(vector(0,0,-386));
while(1)
{
if(key_w == 0 && key_s == 0 && key_e == 0)
{
ent_animate(my,"stand",walk_percentage, ANM_CYCLE);
walk_percentage += 3 * time_step;
}
else
{
phent_addvelcentral(guard, vector(10,0,0)); //roll forward??
phent_addforceglobal(guard, vector(0,0,-50), vector(0,0,35));
if(key_e == 0)
{
ent_animate(my,"walk",walk_percentage, ANM_CYCLE);
walk_percentage += 5 * time_step;
}
}
}
}
I'm puzzled and troubled by this problem for several days. Anyone's help is being looked forward for me. I would appreciate it very much!
Many thanks and All the best!!