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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 868 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 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 | 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