Class RayPickSystem
java.lang.Object
com.marginallyclever.ro3.raypicking.RayPickSystem
A system for finding the nearest
MeshInstance
that collides with a ray.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindRayIntersections
(Ray ray) Traverse the sceneNode
s and find all theMeshInstance
s that collide with the ray.getFirstHit
(Ray ray) Traverse the scene Entities and find the nearestMeshInstance
that collides with the ray.
-
Constructor Details
-
RayPickSystem
public RayPickSystem()
-
-
Method Details
-
getFirstHit
Traverse the scene Entities and find the nearestMeshInstance
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
Traverse the sceneNode
s and find all theMeshInstance
s that collide with the ray.- Parameters:
ray
- the ray to test.- Returns:
- all
RayHit
by the ray. It may be an empty list.
-