simogl.collision
Class ObjectPicker

java.lang.Object
  extended by simogl.collision.ObjectPicker

public class ObjectPicker
extends java.lang.Object

This class can be used to create objects that encapsulate picking operations on object of the scene

Author:
Frank Bruns

Constructor Summary
ObjectPicker(java.util.ArrayList<AbstractGameObject> gameObjects, Camera cam, float pickDiameter)
          Creates a new picking object for the specified list of game objects
 
Method Summary
 AbstractGameObject getObjectAtBack(javax.media.opengl.GL gl, int mouseX, int mouseY)
          Returns the game object that lies at back to the viewer at most
 AbstractGameObject getObjectInFront(javax.media.opengl.GL gl, int mouseX, int mouseY)
          Returns the game object that lies in front to the viewer at most.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectPicker

public ObjectPicker(java.util.ArrayList<AbstractGameObject> gameObjects,
                    Camera cam,
                    float pickDiameter)
Creates a new picking object for the specified list of game objects

Parameters:
gameObjects - list of game objects that can be picked with this picking object
cam - camera object
pickDiameter - diameter of the picking area around the mouse
Method Detail

getObjectInFront

public AbstractGameObject getObjectInFront(javax.media.opengl.GL gl,
                                           int mouseX,
                                           int mouseY)
Returns the game object that lies in front to the viewer at most. If no object was picked, the method returns NULL

Parameters:
gl -
mouseX - mouse x-position
mouseY - mouse y-position
Returns:
game object in front

getObjectAtBack

public AbstractGameObject getObjectAtBack(javax.media.opengl.GL gl,
                                          int mouseX,
                                          int mouseY)
Returns the game object that lies at back to the viewer at most

Parameters:
gl -
mouseX - mouse x-position
mouseY - mouse y-position
Returns:
game object at back