- Home /
How i can a normal vectors?
I've done Raycast in a normal of my cube.
I get the normal with:
RaycastHit.normal
My Question: How I can find the vectors of the vertices of the normal??
Thanks!
Answer by loopyllama · Mar 21, 2011 at 04:15 PM
try barycentric coordinates. the example on the link below does exactly what you are looking for-- an interpolated normal based on the triangle you hit.
http://unity3d.com/support/documentation/ScriptReference/RaycastHit-barycentricCoordinate.html
Answer by flaviusxvii · Mar 21, 2011 at 02:55 PM
I think the terminology is a little confused here. I think you're saying "normal" when you mean "triangle".
http://en.wikipedia.org/wiki/Surface_normal
This is how you get the corner vertexes of the triangle.
http://unity3d.com/support/documentation/ScriptReference/RaycastHit-triangleIndex.html
Answer by efge · Mar 21, 2011 at 02:19 PM
You could use RaycastHit.triangleIndex.
This function works only if the collider that was hit is a MeshCollider.
Your answer
![](https://koobas.hobune.stream/wayback/20220613114002im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can i get point reletive to hit.point 0 Answers
default cylinder to indicate hit.normal 1 Answer
Raycast Normal in Local Rotation? 1 Answer
Help with getting buildings blocks to appear on hit object's normals 1 Answer
How do I obtain the surface normal for a point on a collider (can't use RaycastHit.normal)? 3 Answers