app.DeltaTime sync with frame rate

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
jinxtengu
Posts: 79
Joined: Wed Oct 14, 2009 2:05 pm
Contact:

app.DeltaTime sync with frame rate

Post by jinxtengu » Mon Jun 10, 2019 8:12 am

Hey z game forum.
I'm working on a platform game in z game editor and I've just noticed that the main character jumps lower (in terms of height)
on a slow pc
rather than on a fast pc.
Obviously I'd like to have a standard height reached regardless of the speed the game is currently running on.

the Y position of the main character is currently set as currentmodel.position.y+grav
and "grav" is set to grav-=app.DeltaTime/1

any idea why this isn't syncing to the speed of the pc?
I was under the impression that adding app.DeltaTime fixed this problem.

J

User avatar
Kjell
Posts: 1712
Joined: Sat Feb 23, 2008 11:15 pm

Re: app.DeltaTime sync with frame rate

Post by Kjell » Mon Jun 10, 2019 1:24 pm

Hi jinxtengu,
jinxtengu wrote:
Mon Jun 10, 2019 8:12 am
Obviously I'd like to have a standard height reached regardless of the speed the game is currently running on.
Getting the exact same jumping height using a varying time-step is actually a little more tricky than you might think ... that being said you probably want to use "CurrentModel.Position.Y+grav*App.DeltaTime" ( instead of just "CurrentModel.Position.Y+grav" ).

K

jinxtengu
Posts: 79
Joined: Wed Oct 14, 2009 2:05 pm
Contact:

Re: app.DeltaTime sync with frame rate

Post by jinxtengu » Tue Jun 11, 2019 5:18 am

Kjell wrote:
Mon Jun 10, 2019 1:24 pm
Hi jinxtengu,
jinxtengu wrote:
Mon Jun 10, 2019 8:12 am
Obviously I'd like to have a standard height reached regardless of the speed the game is currently running on.
Getting the exact same jumping height using a varying time-step is actually a little more tricky than you might think ... that being said you probably want to use "CurrentModel.Position.Y+grav*App.DeltaTime" ( instead of just "CurrentModel.Position.Y+grav" ).

K
Ah ok thanks, I'll try to factor that into the gameplay.

Post Reply