|
best pratice for "jumping"
#296544
11/01/09 16:52
11/01/09 16:52
|
Joined: Aug 2009
Posts: 46
gfxExp
OP
Newbie
|
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.
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
Senior Expert
|
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: Hummel]
#296645
11/02/09 09:26
11/02/09 09:26
|
Joined: May 2009
Posts: 445 Peine, Germany
Razoron
Senior Member
|
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
You use
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:
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.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|