Help With Fixing Max Jump Height Being Determined by Frame Rate

Epicnez

New member
Hello,

I am using a UFPS controller and have the jump height determined by how long the player holds down the jump button (I am doing this with the force hold value under the jump ability settings).

However I noticed at lower frame rates the player can't jump as high as higher frame rates. I think this could be because force hold adds more jump force to the player every frame while holding down the jump button, so if there are less frames, less jump force will be applied.

The jump height changing could cause some problems with being able or not able to jump to certain parts in a level. So how can I make this jump force hold frame rate independent, so that I can still hold down the jump button to jump higher, but the max jump height won't be affected by frame rate?

Thank you.
 
If you are using the FixedUpdate loop then the jump height is not determined by the frame rate. On the jump there is a force hold property which allows you to jump higher if you're holding down the button so that will be variable. If you are using the Update loop then you should set the Application.targetFrameRate.
 
If you are using the FixedUpdate loop then the jump height is not determined by the frame rate. On the jump there is a force hold property which allows you to jump higher if you're holding down the button so that will be variable. If you are using the Update loop then you should set the Application.targetFrameRate.
Thank you, I'm setting Application.targetFrameRate, which helps a bit, but is there a way to make the force hold property under the jump ability frame rate independent (even if I have to change around some code in the Ultimate Character Locomotion script)?
 
The Jump ability should update in the same update location as your character, i.e. if your character is using FixedUpdate, so will the ability. Also, the Jump ability does add its force over time in a framerate-independent manner. So, you should be fine as is.
 
The Jump ability should update in the same update location as your character, i.e. if your character is using FixedUpdate, so will the ability. Also, the Jump ability does add its force over time in a framerate-independent manner. So, you should be fine as is.
I'm using a UFPS controller but when the game runs at 30 frames per second the controller can jump 2.5 units high while holding down space, and while the game is running at 60+ frames per second the controller can jump 7+ units high while holding down space. How can I assure my character is using FixedUpdate? Because with the jump height changing it doesn't seem to be. If the controller is running in FixedUpdate, could this jump height problem be caused by something else? Sorry if I missed something and thank you for your help.
 
Sorry, I got mixed up - the force damping hold is framerate-independent, but the "force hold" gets added every frame (this can be seen in Jump.UpdatePosition). You could easily enough just create a custom ability that inherits from Jump, and override UpdatePosition, using the same code but changing the force hold part to be framerate-independent.

I would imagine it would be enough to just change the line m_HoldForce += m_ForceHold; to m_HoldForce += m_ForceHold * deltaTime;. (You might need to increase the force hold amount after this change to compensate)
 
Sorry, I got mixed up - the force damping hold is framerate-independent, but the "force hold" gets added every frame (this can be seen in Jump.UpdatePosition). You could easily enough just create a custom ability that inherits from Jump, and override UpdatePosition, using the same code but changing the force hold part to be framerate-independent.

I would imagine it would be enough to just change the line m_HoldForce += m_ForceHold; to m_HoldForce += m_ForceHold * deltaTime;. (You might need to increase the force hold amount after this change to compensate)
I added the "* deltaTime" in the original jump script on the line you said and it worked great. Thank you! :)
 
Great! Just be careful when updating UCC - if a future update includes changes to that script it'll probably overwrite your changes.
 
This saved my day, I was having issue due to framerate but changing to FixedUpdate fix the issue.

Thank you!
 
Top