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
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 12,885 guests, and 5 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
A Problem of using physics system #189216
03/18/08 14:58
03/18/08 14:58
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
Hi ,guys.
I want to add physics system to a character 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. The 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,30,5);
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
{
if(key_e == 0)
{
ent_animate(my,"walk",walk_percentage, ANM_CYCLE);
walk_percentage += 5 * time_step;
}
}
}
}
Many thanks!!

Re: A Problem of using physics system [Re: LavenderSs] #189217
03/18/08 16:21
03/18/08 16:21
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Well, what are you supposing the entity to do, other than playing it's walk animation? Did you try letting another object collide with the entity?


Always learn from history, to be sure you make the same mistakes again...
Re: A Problem of using physics system [Re: Uhrwerk] #189218
03/19/08 04:20
03/19/08 04:20
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
Well, I'd like to let the entity only walk on the plane ground, that is, walk as a man. I suppose that the animation would be more vivid if physics system exists and 'walk' is a most basic action.

Re: A Problem of using physics system [Re: LavenderSs] #189219
03/19/08 04:43
03/19/08 04:43
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Did you apply any force to the object? The above shown code won't let your entity move, it will just animate it.


Always learn from history, to be sure you make the same mistakes again...
Re: A Problem of using physics system [Re: Uhrwerk] #189220
03/19/08 21:53
03/19/08 21:53
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Yes, you will need to put some phent_addcentralforce() calls (or something similar) somewhere in your while loop to enable your entity to move.

But how is your entity going to keep it's balance? How tall is it compared to it's width or length? If it's taller than it is wide and/or long, then you'll need to find some way to keep your entity standing. Maybe you could apply your forces to the bottom of your entity via phent_addvellocal(), thereby minimizing the problem of keeping your entity standing.

Of course, you could just ignore what I said above if it doesn't apply to your case.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: A Problem of using physics system [Re: MrCode] #189221
03/20/08 07:53
03/20/08 07:53
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
Thank Uhrwerk & MrCode!
As you two said,Yes. I've tried some commands just like phent_addvelcentral and phent_addcentralforce. But the entity never walked forward but roll forward or aside. I am really at a loss. The code I tried is like:


VECTOR guard_speed;
vec_set(guard_speed.x, nullvector);
guard_speed.x = 25 * (key_a - key_d);
guard_speed.y = 25 * (key_w - key_s);
phent_addvelcentral(guard, guard_speed); //roll
// phent_addcentralforce(guard, vector(50,0,0));//still roll

In fact I would appreciate you so much if there comes some code to make it from you.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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