java.lang.Object
com.marginallyclever.ro3.raypicking.RayPickSystem

public class RayPickSystem extends Object
A system for finding the nearest MeshInstance that collides with a ray.
  • Constructor Details

    • RayPickSystem

      public RayPickSystem()
  • Method Details

    • getFirstHit

      public RayHit getFirstHit(Ray ray)
      Traverse the scene Entities and find the nearest MeshInstance that collides with the ray. This computes all intersections and then sorts them by distance, so it is a good idea to keey the ray length short.
      Parameters:
      ray - the ray to test.
      Returns:
      the nearest RayHit by the ray, or null if no entity was hit.
    • findRayIntersections

      public List<RayHit> findRayIntersections(Ray ray)
      Traverse the scene Nodes and find all the MeshInstances that collide with the ray.
      Parameters:
      ray - the ray to test.
      Returns:
      all RayHit by the ray. It may be an empty list.