Calculating Vehicle Speed and Acceleration Curve for Game Programmers

Click For Summary
To calculate vehicle speed and acceleration in a game without external forces, use a constant engine force (Fe) opposed by a drag force (Cd * velocity²). At top speed (155 MPH), the forces balance, allowing the calculation of drag force as Cd = Fe/(155²). The time to reach 60 MPH in 4.5 seconds can be modeled using the integral of the net force equation, leading to the relationship Fe * (1 - (velocity/155)²) over 4.5 seconds equaling 60. This method allows for replicating calculations for different car types in the project. Understanding these dynamics is crucial for accurate speed modeling in game programming.
pacificapilot
Messages
3
Reaction score
0
I am programming a game in which there are no outside forces acting on the car aside from the engine. I will not be having gears, so that is not a factor. I just want to know if there is an equation I can use to calculate the car's speed at any given time. The car will start off accelerating quickly, but then as it approaches top speed, it will accelerate slower and slower until it reaches top speed. Also, finding the car's 0-60 time is easy, just a google search, but because of this curve, that does not give me the original speed. Is there a way to figure that out?

The car's stats are:
0-60 in 4.5 seconds
Top Speed: 155 MPH

Please show your steps so that I can replicate it for the other car types in my project.
 
Physics news on Phys.org
pacificapilot said:
The car will start off accelerating quickly, but then as it approaches top speed, it will accelerate slower and slower until it reaches top speed.
That may depend on how it accelerates or decelerates. So, if you want to accurately get the speed of any time, the change of acceleration should also be given.
 
pacificapilot said:
Also, finding the car's 0-60 time is easy, just a google search, but because of this curve, that does not give me the original speed. Is there a way to figure that out?

The car's stats are:
0-60 in 4.5 seconds
Top Speed: 155 MPH

Please show your steps so that I can replicate it for the other car types in my project.

What do you mean by the original speed?
 
Use a constant engine force Fe opposed by a drag force Cd * velocity2. Since the top speed is 155, you know that the engine force and drag force are in balance at 155 mph. So Fe-Cd*1552 = 0. and Cd = Fe/(1552). You also know the time to 60 is 4.5. So the second integral of (Fe - Cd*velocity2) = Fe * (1-(velocity/155)2 over 4.5 seconds is 60. You can calculate Fe and then Cd from that.

PS. The zero to 60 mph times from Google searches are certainly for a standing start.
 
  • Like
Likes pacificapilot
SteamKing said:
What do you mean by the original speed?
Original as in the starting speed, which, in this case, is 0 mph
 
FactChecker said:
Use a constant engine force Fe opposed by a drag force Cd * velocity2. Since the top speed is 155, you know that the engine force and drag force are in balance at 155 mph. So Fe-Cd*1552 = 0. and Cd = Fe/(1552). You also know the time to 60 is 4.5. So the second integral of (Fe - Cd*velocity2) = Fe * (1-(velocity/155)2 over 4.5 seconds is 60. You can calculate Fe and then Cd from that.

PS. The zero to 60 mph times from Google searches are certainly for a standing start.
Thanks!
 
For simple comparison, I think the same thought process can be followed as a block slides down a hill, - for block down hill, simple starting PE of mgh to final max KE 0.5mv^2 - comparing PE1 to max KE2 would result in finding the work friction did through the process. efficiency is just 100*KE2/PE1. If a mousetrap car travels along a flat surface, a starting PE of 0.5 k th^2 can be measured and maximum velocity of the car can also be measured. If energy efficiency is defined by...

Similar threads

  • · Replies 26 ·
Replies
26
Views
7K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 27 ·
Replies
27
Views
21K
  • · Replies 95 ·
4
Replies
95
Views
7K
  • · Replies 14 ·
Replies
14
Views
21K
Replies
13
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K