Raycasting to points on the opposite side of a mesh

Based on a recent thread on the XSI mailing list, here’s a simple example of using raycast to find points on the other side of a mesh.

In a nutshell:

  • Negate the point normal so it points inside the mesh, and use that as the raycast direction.
  • For the start position of the raycast, don’t use the PointPosition (because you’ll just get the same point back as the raycast hit). Instead, move along the normal a bit and use that as the starting point for the raycast.
  • In 2012, you can use the VertexIndex attribute to get the ID of the “opposite” point.