- Home /
rotating hovercar to be at the same angle as the terrain/object below it
i have a hovercar and a raycast that shoots down and i want to know how to make the hovercar match the angle of the terrain, like a ghost out of halo.
Comment
Best Answer
Answer by ByteSheep · Feb 01, 2012 at 03:16 AM
Try using the RaycastHit.normal function which should give you a vector3 value. This should show the value in the debug console..
var hit : RaycastHit;
function Update () {
var dwn = transform.TransformDirection (Vector3.down);
if (Physics.Raycast (transform.position, dwn, hit))
{
Debug.Log(hit);
}
}
Your answer
Follow this Question
Related Questions
New UI ~ Check for mouse-hover 1 Answer
Raycast Hover 0 Answers
Spherical velocity conservation 1 Answer
Best way to "highlight" an object on mouse over 3 Answers
How to disable halo when it is already enabled via script C# 0 Answers