Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make entity move under physics system? #190185
03/25/08 12:46
03/25/08 12:46
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

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 Offline
Expert
Uhrwerk  Offline
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: Uhrwerk] #242155
12/21/08 18:02
12/21/08 18:02
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
???
using physics for a "real" Human-model???

How should this work! if the guard is on a slope he will fall down like a box?
I don't think that will look nice!

Re: How to make entity move under physics system? [Re: kasimir] #242673
12/25/08 03:54
12/25/08 03:54
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
...ragdoll physics


xXxGuitar511
- Programmer
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 Offline
Senior Member
kasimir  Offline
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 -.-
Code:
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 Offline
Junior Member
fat32  Offline
Junior Member

Joined: Jul 2007
Posts: 69
hi .can say more sample ?


dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1