How to make my velocities framerate independent?

I’m using the get and set physics linear velocity nodes to apply movement to a ball.
A kick ball event is fired by the player and takes in a value between 0 and 1. This is multiplied by the max speed of the FloatingPawnMovement. I then multiply the player’s forward vector by this amount to set the balls’ velocity in the direction that the player is facing.

A simple drag is applied in the balls’ tick. At the moment this drag value is set at 0.997 as anything below that makes the ball slow too quickly.

After a little bit of testing at 60fps and 120fps there is a noticeable difference in the time it takes for the ball to stop travelling.

How can I make this framerate independent? I understand I should be plugging in the delta time somewhere but I do not know where.


Try fixing the framerate from the project settings :innocent:

I don’t want to lock the frame rate if I can help it.

I did some research and it seems like you’d either need to use a different node like Add Force or play with the substepping settings under Engine - Physics to your liking. You can easily find those settings I mentioned by searching for “framerate” in the project settings and scrolling down a little bit.

Hope this helps! :blush:

Thanks. I will take a look.

There is Delta Seconds on the Tick node - use it. Or, much better:

Eventually I found two ways to solve this issue.
First way was to put the drag on a looping timer with a 0.01 tick:

I decided that I wanted drag to be always there, just like linear damping. After a little searching I found this post:

This helped me create a linear damping blueprint that only affected the x and y axis which is also being framerate independent.

1 Like