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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s