- Home /
Getting the orientation of Hit triangle?
i would like to know an economic way to get the orientation of the Hit mesh triangle , which can be acquired by casting physics.Raycast ?
i want to use this information to make the playing character match the rotation of the hit mesh triangle.
thanks
Answer by Huacanacha · Nov 07, 2013 at 11:21 PM
Use a Raycast method that takes a RaycastHit parameter. The hit info includes the normal, which gives you the orientation of the surface at the hit point. You can also get the triangle index if you really want to dig deep.
The normal IS the orientation, so if you want to set the player to face this direction use:
player.transform.forward = hitInfo.normal;
look at my question again , i actually have all the info about my triangle and the normals which can't be acquired with RaycastHit in case of raycasting !!
sorry to say your answer has no proceeding point.
The normal IS the orientation. If you want to set the player to face this direction use:
player.transform.forward = hitInfo.normal;
thanks man it did worked , note i only needed the Y axis orientation to make the actor put hist back to the wall , i just hope if your comment was your answer so other could see it fit
Your answer
Follow this Question
Related Questions
How to change the camera rotation/orientation? 1 Answer
Change transform.forward while slerping rotations around the transform.forward axis 1 Answer
Issue pointing towards mouse 1 Answer
iAds from ADBannerView offset on orientation change 1 Answer
How to get an object to return to a "resting" orientation? 0 Answers