How can I calculate speed based on previous speed?

  • Context: Undergrad 
  • Thread starter Thread starter Tim Leijten
  • Start date Start date
  • Tags Tags
    Force Speed Time
Click For Summary
SUMMARY

The discussion focuses on calculating speed in a Train Simulator program by revising the existing formula to incorporate previous speed and frame timing. The proposed formula is: Speed = (f/m) * time between frames + previous speed. This approach addresses issues related to frame rate drops and force changes, providing a more stable speed calculation. The user seeks assistance in implementing this method effectively.

PREREQUISITES
  • Understanding of basic physics concepts, specifically force and mass.
  • Familiarity with programming concepts related to real-time simulations.
  • Knowledge of frame timing in game development.
  • Experience with mathematical modeling in programming.
NEXT STEPS
  • Research "Physics-based simulation in game development" for foundational concepts.
  • Learn about "Frame rate management techniques" to handle performance drops.
  • Explore "Numerical methods for real-time calculations" to improve accuracy.
  • Investigate "Game engine physics libraries" like Unity's Rigidbody for built-in solutions.
USEFUL FOR

Game developers, simulation programmers, and anyone involved in real-time physics calculations in software development.

Tim Leijten
Messages
28
Reaction score
1
Hi,

I am developing a Train Simulator kind of program where I calculate speed each frame.
I currently do that by:
Speed = (f/m)*elapsed frames*time between frames
This works, but goes wrong when there are framerate drops or if the force changes, that's why i want to calculate the speed with the speed in the previous frame, and the time a frame took to complete.
Can someone help me with calculating speed based on the previous speed and time between frames?Thanks
 
Physics news on Phys.org
It's just a minor revision of the equation you have:
Speed = (f/m)*time between frames+ previous speed
 
  • Like
Likes   Reactions: Tim Leijten and anorlunda
russ_watters said:
It's just a minor revision of the equation you have:
Speed = (f/m)*time between frames+ previous speed
Thank you!
 
  • Like
Likes   Reactions: russ_watters

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 26 ·
Replies
26
Views
5K
Replies
15
Views
3K
  • · Replies 26 ·
Replies
26
Views
971
  • · Replies 13 ·
Replies
13
Views
7K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K