Jump to content
  • Advertisement
Sign in to follow this  
gstation

Making a car controller

This topic is 3300 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

Hi, I am trying to simulate the behavior of car. I do not need to take the wheels into account physically (I might turn them or not graphically). I'm currently pretty stuck while trying to change direction of the car. What I basically try to do, it take the velocity vector facing front of the car, and using trigonometry, split it to the X and Y values of the the velocity, so the car moves in the right direction. But I must be doing something wrong, since my car goes wild. Is there a good reference to help me understand what im doing wrong, what I should be doing, or does anybody know what's wrong?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
What I basically try to do, it take the velocity vector facing front of the car, and using trigonometry, split it to the X and Y values of the the velocity, so the car moves in the right direction.
Perhaps you could post the code (be sure to use [ source ] tags to preserve formatting).

Share this post


Link to post
Share on other sites
Sounds like a simple 2d "unicycle" model might do the trick...

Here's a continuous-time model

dx/dt = vx
dy/dt = vy
dvx/dt = -ω vy + a vx
dvy/dt = ω vx + a vy

where (x, y, vx, vy) is the car's state (position and velocity), and u=(a, ω) is the control input signal, giving at any time the forward acceleration and turning speed.

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!