Ritu Singh
Problem:
My code has a box that gets pushed with an initial velocity. I'm trying to make it travel the same distance with the same time taken regardless of the fps.
When I run the code with an FPS of 60, this is my debug information
When I run it with an FPS of 120, this is my debug information
I'm expecting both the debug information to be the same. I did some math and concluded that I should multiply velocity by dt and multiply friction by dt square, but clearly that doesn't work. So what's wrong with the code then?
Solution:
Don't square dt in your velocity update.
You are using Euler integration to estimate the fractional changes to position and velocity for small dt, so in the case where acceleration is constant (like from force of friction) or you are using Euler to estimate for a very small delta time, you can just multiply by delta t
just as
Suggested blogs:
>How to fix mouseover event glitch in JavaScript?
>How to use querySelectorAll()" with multiple conditions in JavaScript?
>Fix ASP.NET Core Model Binding Not Working issue.
>How to create a zip file and return it to client for download?
>How to Group large number of data based on CreatedDate(DateTime)?
>Issues converting ASPX Web app from .net 3.5 to 4.8.1