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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 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
best pratice for "jumping" #296544
11/01/09 16:52
11/01/09 16:52
Joined: Aug 2009
Posts: 46
gfxExp Offline OP
Newbie
gfxExp  Offline OP
Newbie

Joined: Aug 2009
Posts: 46
Hi,

I have a physics "PH_SPHERE" entity "player_ball" of which x, y, z speeds are set via key pressed within while loop. What is the best option to make it "jump".

I tried changing player_ball.z and c_move, no results. BTW the "ph_setgravity" is set to -386 on z axis.

However, using the following gets the job done, but with time_step it jumps different heights on different max fps.

Code:
phent_addvelcentral (player_ball, vector(0, 0, 100));



Ans for my doubt, is there a "best practice on jumping"? Any suggestions?

Re: best pratice for "jumping" [Re: gfxExp] #296571
11/01/09 20:32
11/01/09 20:32
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Edit:
@Hummel: You're right.

c_move has no effect on physic entities and to change the x,y,z position you have to disable its physical properties (check "phent_enable") temporarily. phent_addvelcentral/-centralforce is the right way.

Last edited by H.F.Pohl; 11/01/09 23:51.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: best pratice for "jumping" [Re: Superku] #296572
11/01/09 20:45
11/01/09 20:45
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
dont use time_step - it´s a force-vector not a speed-vector wich moves the entity during several frames

Re: best pratice for "jumping" [Re: Hummel] #296645
11/02/09 09:26
11/02/09 09:26
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
You use
Code:
phent_addvelcentral (player_ball, vector(0, 0, 100));


only once, not in a loop. So no value has to be rational with the framerate. If you use it in a loop, you have to make it rational like that:
Code:
while(1)
{
 .....
 phent_addvelcentral (vector(player_ball.x*time_step,player_ball.y*time_step,player_ball.z*time_step, vector(0, 0, 100));
 .....
 wait(1);
}




Last edited by Razoron; 11/02/09 09:27.

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