- Home /
Check texture of the face with raycast
How do you check what texture is applied on a certain face using a raycast?
Comment
Do you have multiple materials applied to your object or a single texture uv mapped, or...
Best Answer
Answer by robertbu · Dec 01, 2013 at 10:49 PM
The RaycastHit structure that you pass to many versions of the Raycast() call returns a textureCoord:
http://docs.unity3d.com/Documentation/ScriptReference/RaycastHit-textureCoord.html
Assuming you know the uvs of each side, you can use the textureCoord to compare with the uvs to find the side.