Solved

Rotate object to sit on a plane.

Posted on 2003-10-30
4
344 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ruby, Python, Perl, nodeJS, JavaScript, AJAX, Jscript 2 220
word search puzzle 2 1,131
The problem with the movement of the serpent (snake game) 1 779
dividesSelf challange 15 111
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

9 Experts available now in Live!

Get 1:1 Help Now