Stabilizing the vehicle in a racing game

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Stabilizing the vehicle in a racing game

Postby mikeman42 » Tue Feb 22, 2011 8:54 am

I have a problem which is simple enough, but unfortunately I haven't been able to sort it out. Basically, I'm making a podracing game, and I want the vehicles to stay "up" in respect to the track road(which is not always perpendicular to the Y axis though). So, my first method was to find out the angle(or dot product) between the vehicle's Y axis and the floor normal is, and correct it by applying a torque. Something like this:

torque=vehicle.ZAxis()*(Dot(vehicle.YAxis(),normal)-1)

However, this does not seem right when I start to rotate the vehicle around its Y-Axis, for steering. Anyone has any ideas on how the correct code should look like? Thanks!
mikeman42
 
Posts: 19
Joined: Tue May 01, 2007 6:08 pm

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron