Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Rotate object to sit on a plane.

Posted on 2003-10-30
Medium Priority
359 Views
What i need to do is to rotate an object - car - so that it sits on my terain.

I can obtain a Normal vector which is the up vector for the object but i do not know how i can take this normal and turn it into the angles i need to rotate the car.

In doing this, i also need to include a direction for which my model should be facing in the world.

Thankyou for any help and ideas.
0
Question by:crogookah
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions

Expert Comment

ID: 9745530
Hi,
I'm having the same doubt can anyone  pls help me with some ideas of how to & what to do.
Thank u for any help.
0

Accepted Solution

F4Codec earned 375 total points
ID: 9746982
I think you can do this with the dot product.

You will need, a normal for your particular bit of terrain. If its flat, then this is pointing straight up, not flat and it will be pointing in some other direction.
Now - if you use the dot product equation ->
A DOT B = cos angle
then you can see a dot product of the straight up vector and your normal will give you cosine of the angle.
This will be 1 if they are identical, 0 if perpendicular, -1 if opposite and various intermediate values in between.

So - the angle that you are tilted at is arccos(TerrainNormal DOT UpUnitVector)

Do this twice for roll and pitch, yaw is up to your driver!

0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
###### Suggested Courses
Course of the Month10 days, 6 hours left to enroll

#### 609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.