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!