- Home /
What does it mean if my RaycastHit.texturecoord changes dramatically on either side of adjacent triangle edges?
I've got a working implementation of 2D uGUI projected on 3D meshes. As seen in many related posts, I raycast onto the 3D mesh, multiply the RaycastHit.textureCoord by the RenderTexture dimensions and translate that to an input position in my uGUI Canvas.
Unfortunately, one of my meshes (a tablet-like device with a curved monitor) is providing erratic textureCoord values. After some testing, I realized that when I cross the threshold between two triangles in my mesh, my textureCoord Y value jumps significantly.
What could cause this? I thought that maybe the mesh's UVs are incorrect, but if that were the case, wouldn't that mean the RenderTexture would be rendered incorrectly on that mesh as well? (I'm using the same mesh for the MeshCollider)
Could this have something to do with the fact that the monitor (which is what contains the raycasted collider and renders the Render Texture contents) is a submesh of the overall device mesh?