|
-
Jan 17th, 2005, 09:00 PM
#1
Thread Starter
PowerPoster
Turn Plane into Matrix
Alright I got some terrain collision detection routines working.
Currently I am able to generate a sliding plane, ie. the plane which would slide the unit along a wall for example, or up the slant of a hill.
I was wondering if there is anyway I can use that plane to determine what angle the plane is at so I can rotate certain objects to that angle.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Jan 31st, 2005, 03:55 PM
#2
Not NoteMe
Re: Turn Plane into Matrix
How are you representing the plane? You could be represeting it as an angle from each axis or as a vector normal to the plane, in which case i don't think it would be too tough to get the angle for an object.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Jan 31st, 2005, 06:42 PM
#3
Fanatic Member
Re: Turn Plane into Matrix
Sounds like you want the plane's NORMAL
how are you representing the plane?
if it's already as "Ax + By + Cz = D" then the normal is just (A, B, C)
if you have the three points, you can use the vectors between them, find their cross product which also happens to be the normal to the plane!
Once you've got the normal, which is just a 3D vector, you can do a conversion from that to spherical coordinates to get whichever angle you want 
For example, say you want the elevation...
if in your game world, up/down is +/- Y (for example, the ground is the XZ plane), then to get elevation, you have one vector for your plane, and one for the base plane (in this case, the normal is just (0, 1, 0))
Then, you find the angle between the normals, using the dot product. This (or 180 degrees - this...depends what you want) is then the angle between the planes, which is your plane's elevation
sql_lall 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|