Solved

Rotate object to sit on a plane.

Posted on 2003-10-30
4
342 Views
Last Modified: 2013-12-08
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
Comment
Question by:crogookah
4 Comments
 

Expert Comment

by:anandhir
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

by:
F4Codec earned 125 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

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

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

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now