Jump to content
  • Advertisement
Sign in to follow this  
kravibom

How to handle keyboard input in racing games

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

I would just start with something simple and play around with it. That something simple could be something like interpreting the input as an angular velocity applied to the steering wheel. Cap the position of the steering wheel to make sure it stays within [-MaxAngle,+MaxAngle], and add a restitution of some sort when the keys are released.

 

Test this scheme at a fixed, typical speed, then see if it needs any dependence on the speed.

Share this post


Link to post
Share on other sites

I would just start with something simple and play around with it. That something simple could be something like interpreting the input as an angular velocity applied to the steering wheel. Cap the position of the steering wheel to make sure it stays within [-MaxAngle,+MaxAngle], and add a restitution of some sort when the keys are released.

 

Test this scheme at a fixed, typical speed, then see if it needs any dependence on the speed.

 

Well, some actual car manufacturers implements sort of steering wheel sens. reduction  with speed. That is done for not allowing car to flip or went out of control on speed turns.

I'm happy how car behaves in turns with no aids. But it's getting pretty messy when it trying to, say, change the lane on highspeed. The project I'm working on have pacejka implementation for wheels. I've talked to some experts, they suggest to find wheel's perfectgrip angle (where grip at it's top) and since then, if the speed more then some variable, apply a small amount of steer to wheels.

Share this post


Link to post
Share on other sites

The carx one will be based on something similar to traction control, where it will evaluate the amount of slip/grip from the actual tire physics simulation (ask pacejka what the optimal slip angle is) and determine a which angle the tires will completely lose traction. The steering controller will then choose to limit you so you don't turn past this angle, and that grip/control is maintained.

Edited by Hodgman

Share this post


Link to post
Share on other sites
You can also model centrifugal force pushing the steering wheel back to neutral, with the effect that (for the same left or right button press) the curvature of the trajectory increases fastest when you are going straight. Somewhat complex formulas involving grip and car orientation might be needed to do a really good job, but if you want to include drifting you are expected to deal with such factors anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!