# Car driving game

This topic is 4650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to develop a car driving game using my logitech steering wheel. What I want to know is, if I read different torque values from the wheel, how should I move the car? I know how to mode the car if I read different steering positions. Thanks.

##### Share on other sites
Very basically, the pedal depression indicates the acceleration of the car. So in the car you should add code for holding position, velocity and acceleration and how to update them (position from velocity, velocity from acceleration). The acceleration is read from the input device.

This is a very simplistic scheme; you can expand on it by using gear boxes, friction, etc. Greetz,

Illco

##### Share on other sites
The above advice was for speed, but it's similar for steering, except you might not want to bother with acceleration - just treat the torque reading as being proportional to the change in angle of your car (equivalent to velocity in the above post). This means you might want to store the following variables for your car:
position, speed, linear acceleration
and
angle.

To move the car, you then find the unit vector specified by the angle (the direction in which the car is facing) and multiply that by the speed. You then add the acceleration to the speed and the steering wheel torque to the angle.

Edit: That probably won't look very good, though, thinking about it, because it would allow you to turn the car even whilst stationary. Perhaps take the approach given in the previous post with an acceleration vector, and you will need to modify the acceleration by a small angle in order to take account of the steering wheel. The angle of the car (so that you know how to draw it) would then have to be inferred from the velocity.

##### Share on other sites
angle += velocity * rotationalVelocity;

##### Share on other sites
Car Physics
Physics of Racing Series

More links about steering and such can be found on this page where the steer page is the one that I used most.

• 9
• 10
• 12
• 10
• 10