Game Development Reference
In-Depth Information
Similarly, we can calculate the bounding sphere. Checking against a radius is a bit
faster, but it might cause more false positives, as shown here:
float radius = box.getDimensions().len()/2f ;
cam.frustum.sphereInFrustum(position, radius);
Here, radius is the radius of the bounding sphere.
Ray picking
It would be great if we could interact with the game objects. In a 2D scene, it is easy
as we can map the 2D coordinates of the game object with the input coordinates.
However, in a 3D game, it is different as the game object is positioned in 3D world
coordinates and the input is available as 2D screen coordinates. A familiar scenario
is a first person shooter game, wherein on shooting the bullet it is traced through the
scene until a collision is detected. Ray picking is the process of shooting a line or ray
from the camera through the 2D view port into the 3D game world until it hits an
object, as shown here:
 
Search WWH ::




Custom Search