Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,392 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Player Physics #223185
08/22/08 15:55
08/22/08 15:55
Joined: Dec 2006
Posts: 17
H
hallsofvallhalla Offline OP
Newbie
hallsofvallhalla  Offline OP
Newbie
H

Joined: Dec 2006
Posts: 17
Thought I would make my own thread for this because I seem to be making a obvious mistake. I cant find an answer anywhere so others must not be making this mistake

I have a player I added physics to. I used the same method as was posted in another thread:

action myplayer()
{

myplayer = me;

ph_setgravity (vector(0, 0, -386));
phent_settype (myplayer, PH_RIGID, PH_BOX);
phent_setmass (myplayer, 3, PH_BOX);
phent_setfriction (myplayer, 80);
phent_setdamping (myplayer, 40, 40);



while (1)
{
if(key_w)
{

myplayer_speed.x = 5 ;
myplayer_speed.y = 0 ;
myplayer_speed.z = 0;
phent_addvelcentral (myplayer, myplayer_speed);
}
wait(1);
}


The problem is my player falls over. Then he just tumbles around. Is this in my model? Is there a setting I am missing?
How do I keep him standing upright?

Any help is most appreciated.

Last edited by hallsofvallhalla; 08/22/08 15:56.
Re: Player Physics [Re: hallsofvallhalla] #223190
08/22/08 16:11
08/22/08 16:11
Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
O
Omicron_NEGA Offline
Warez kiddie?
Omicron_NEGA  Offline
Warez kiddie?
O

Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
wait a sec..

Last edited by Omicron_NEGA; 08/22/08 16:17.

P4 3.6GHz x2 8GB RAM DDR2 GeForce8800GTS
Re: Player Physics [Re: Omicron_NEGA] #223192
08/22/08 16:17
08/22/08 16:17
Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
O
Omicron_NEGA Offline
Warez kiddie?
Omicron_NEGA  Offline
Warez kiddie?
O

Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.

action myplayer()
{

myplayer = me;
myplayer.fat = on;
myplayer.narrow = on;
c_setminmax(myplayer);

phent_settype (myplayer, PH_RIGID, PH_BOX);
phent_enable( myplayer, 1 );
ph_setgravity (vector(0, 0, -386));
phent_setmass (myplayer, 3, PH_BOX);
phent_setfriction (myplayer, 80);
phent_setdamping (myplayer, 40, 40);



while (1)
{
if(key_w)
{

myplayer_speed.x = 5 ;
myplayer_speed.y = 0 ;
myplayer_speed.z = 0;
phent_addvelcentral (myplayer, myplayer_speed);
}
wait(1);
}


P4 3.6GHz x2 8GB RAM DDR2 GeForce8800GTS
Re: Player Physics [Re: Omicron_NEGA] #223209
08/22/08 17:27
08/22/08 17:27
Joined: Dec 2006
Posts: 17
H
hallsofvallhalla Offline OP
Newbie
hallsofvallhalla  Offline OP
Newbie
H

Joined: Dec 2006
Posts: 17
no change. He still falls over and when I hit w he just rolls forward bouncing everywhere.

Re: Player Physics [Re: hallsofvallhalla] #223212
08/22/08 17:33
08/22/08 17:33
Joined: Dec 2006
Posts: 17
H
hallsofvallhalla Offline OP
Newbie
hallsofvallhalla  Offline OP
Newbie
H

Joined: Dec 2006
Posts: 17
could it be my terrain, should it be registered as a physics object?

Re: Player Physics [Re: hallsofvallhalla] #223216
08/22/08 17:37
08/22/08 17:37
Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
O
Omicron_NEGA Offline
Warez kiddie?
Omicron_NEGA  Offline
Warez kiddie?
O

Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
nope and i have no idea for this..

btw,what is ur terrain look like?

edit:try delete "phent_setdamping (myplayer, 40, 40);"
and what is ur Gamestudio Version/Edition?

Last edited by Omicron_NEGA; 08/22/08 17:41.

P4 3.6GHz x2 8GB RAM DDR2 GeForce8800GTS
Re: Player Physics [Re: Omicron_NEGA] #223218
08/22/08 17:42
08/22/08 17:42
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Players and Physics = Bad idea.

But if you want to try, what you'll want to do is recenter your model around it's feet. The physics engine should then use that as the center of gravity.

Another technique I've found useful is to modify the bounding box to be a flat "tile" low on the feet. This way, the model visually will stand tall and walk, but physically will be a flat tile gliding on the ground.

So I don't think anything is wrong with your code or your model... it's just that your model may be "top heavy" and thus the physics engine is just doing it's job.

Re: Player Physics [Re: fastlane69] #223223
08/22/08 18:08
08/22/08 18:08
Joined: Dec 2006
Posts: 17
H
hallsofvallhalla Offline OP
Newbie
hallsofvallhalla  Offline OP
Newbie
H

Joined: Dec 2006
Posts: 17
its got to be something i am doing wrong or just lack of thought put behind the idea that people will use tall humanoid models in the physics system. I put a huge cylinder base on my model and he still flips around and tips over.

Maybe I wont use physics. smile Seems to be too much trouble. i would of assumed there would have been a special physics setting for player models.

Well back to the drawing board. Thanks for the help.

Re: Player Physics [Re: hallsofvallhalla] #223225
08/22/08 18:16
08/22/08 18:16
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:
people will use tall humanoid models in the physics system.


AFAIK, nobody does for the reasons you've encountered. However, if you read my post, you'll note that IMO your code is right for the physics engine is just doing what it's supposed to do: Physics! smile

Oh, and there are ways of doing it as I've stated above... you have to work with physics, not against it.

Re: Player Physics [Re: fastlane69] #223227
08/22/08 18:38
08/22/08 18:38
Joined: Dec 2006
Posts: 17
H
hallsofvallhalla Offline OP
Newbie
hallsofvallhalla  Offline OP
Newbie
H

Joined: Dec 2006
Posts: 17
i understand that, but this is just one character, I can only imagine how bad it will get when i start adding lots of movable models. I am developing a isometric Sci-Fi RPG so Physics are not that important. Just a nice additive.

The 3dgs physics are nice and I am not complaining. Just wish the had a scripting command like phent_sethumanoid (myplayer); to tell the engine its a biped and to set the gravity properly. Guess we cant have our cake and eat it too smile

edit: whats the best method to simulate gravity without the use of physics? To keep the player on the terrain and to fall? Just a constant -z?

Last edited by hallsofvallhalla; 08/22/08 18:46.
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | 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