Sign in to follow this  
crap

Car driving game

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this