Skip to main content
GameDev.net gamedev.net
🔒 Locked

Car acceleration

Started by hugofromboss Dec 1, 2009 at 7:25 AM 0 replies 2.6k views
Original Post
hugofromboss
hugofromboss
Hello, I have in part written a 3d racing game (openGL). Implemented physics etc and been able to drive around however, I am trying to make the cars driving physics more realistic I have read over and implemented some of: http://regedit.gamedev.pl/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html However, it fails to cover the link between the user pressing the forward arrow to the car actual gaining momentum and reaching is peak mph which is then limited by forces. My question is this from pressing the forward key how can I translate this into a realistic motion? i.e. to get the car from a to b to calculate velocity, acceleration etc. Thanks in advance for you help.
bzroom
bzroom
Reading this post and thread may help:
http://www.gamedev.net/community/forums/viewreply.asp?ID=3560185
http://www.gamedev.net/community/forums/topic.asp?topic_id=542915

The speed is not limited by forces, it is limited by the engine's maximum rpm (assuming the engine torque is capable of overcoming resistance forces, and it almost always can). At some point the engine cannot go any faster, if you want the car to go faster, you'd have to disconnect the engine, which means no more torque applied to the wheels.

The car is accelerated by the torque of the engine being converted to linear motion through the wheels.

Your forward key will apply the torque. Say you want a real basic engine simulation where it has a max torque which is scaled by the throttle. The throttle is your forward key. You can also incorperate a transmission with one or more gear ratios between the engine torque and wheel torque.

float engineSpeed = wheelSpeed / gearRatio;
if (engineSpeed < 0) stalled();
if (engineSpeed > maxEngineSpeed) exploded();

float torqueEngine = maxTorque * throttle;
float wheelTorque = torqueEngine * gearRatio;
carForce = wheelDirection * wheelTorque / wheelRadius;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.