1 registered members (TipmyPip),
18,038
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to make entity move under physics system?
#190185
03/25/08 12:46
03/25/08 12:46
|
Joined: Nov 2007
Posts: 37
LavenderSs
OP
Newbie
|
OP
Newbie
Joined: Nov 2007
Posts: 37
|
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!!
|
|
|
Re: How to make entity move under physics system?
[Re: LavenderSs]
#190186
03/25/08 14:58
03/25/08 14:58
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Don't use PH_SPHERE. Use PH_BOX instead.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: How to make entity move under physics system?
[Re: xXxGuitar511]
#242697
12/25/08 08:53
12/25/08 08:53
|
Joined: Dec 2005
Posts: 490 Germany/Berlin-Velten
kasimir
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
|
Newton uses an upvector-joint to fix the tilt, roll of the player, but i cannot find a way to do this in 3dgS/ODE until now... tried this with PH_BALL and a dummy, but the dummy doesn't move -.-
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 1, PH_BOX);
phent_setfriction (my, 50);
phent_setdamping (my, 50, 100);
phent_setelasticity (my, 30, 30);
ENTITY* upvector = ent_create(NULL, vector(my.x, my.y, my.z + 100), 0);
set(upvector, PASSABLE);
var jointID = phcon_add(PH_BALL, me, upvector);
phcon_setparams1(jointID, nullvector, nullvector, nullvector);
phcon_setparams1(jointID, nullvector, nullvector, nullvector);
while (1)
{
vec_set(upvector.x, my.x);
upvector.z += 100;0;
...
Last edited by kasimir; 12/25/08 08:55.
|
|
|
Re: How to make entity move under physics system?
[Re: kasimir]
#243467
12/30/08 07:05
12/30/08 07:05
|
Joined: Jul 2007
Posts: 69
fat32
Junior Member
|
Junior Member
Joined: Jul 2007
Posts: 69
|
hi .can say more sample ?
dobidob hosein_dig and max_man7000 game HAPPY NEW YEAR !!
|
|
|
|