Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rotation from Normal?

Started by miketavius Dec 8, 2001 at 1:22 AM 0 replies 850+ views
Original Post
miketavius
miketavius
I''m currently working on a futuristic racing game similar to f-zero (but of course in 3d), and I need to somehow retrieve a rotation matrix from a plane normal (the track), so I can apply it to the car. It looks quite silly when the car travels up the track, or on a ramp... and stays perfectly flat I''m using OpenGL, so I need the rotation matrix to be in column major form. I''m posting this as a last resort, cuz I''ve been searching the forums all night, but have yet to find a definitive answer to my question. Any help would be appreciated!!!
henryx
henryx
You need more than just the plane normal to get the car''s rotation matrix. However, if you know the cars direction in the x-z plane - which I assume that you have to point the car in the correct direction then you can build a rotation matrix from that info.

The up vector (U) of the car is the plane normal.

You already know the x and z component of the direction vector (D) for the car so from U.D = 0 you can find the z component of D.

Normalise D then the right vector (R) for the car is R=DxU.

You now hae all three vextors for the rotation matrix and can build it. Remember to add in the positional components as well.

I haven''t tried this out but hopefully it will get you going in the right direction (sorry about the pun).

henry

HenryLecturer in Computer Games TechnologyUniversity of Abertay DundeeScotlandUK

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.