Game Development Reference
In-Depth Information
12. We define Ray using mousePos3D as the origin and clickDir as the direc-
tion and a CollisionResults instance to store any collisions that will occur.
13. Now, we can define a for loop that goes through our selectables list and
checks whether Ray intersects with any of BoundingVolumes . The Colli-
sionResults instance adds them to a list, and we can then retrieve the closest
collision which, for most cases, is the most relevant one, as follows:
for (Spatial spatial : selectables) {
spatial.collideWith(ray, results);
}
Search WWH ::




Custom Search