com.jme.intersection
Class PickData

java.lang.Object
  extended by com.jme.intersection.PickData
Direct Known Subclasses:
TrianglePickData

public class PickData
extends java.lang.Object

PickData contains information about a picking operation (or Ray/Volume intersection). This data contains the mesh the ray hit, the triangles it hit, and the ray itself.

Author:
Mark Powell

Field Summary
protected  float distance
           
 
Constructor Summary
PickData(Ray ray, Geometry targetMesh, java.util.ArrayList<java.lang.Integer> targetTris, boolean checkDistance)
          instantiates a new PickData object.
PickData(Ray ray, Geometry targetMesh, boolean checkDistance)
           
 
Method Summary
protected  float calculateDistance()
          For bounds picking this method returns the distance of the ray origin to the bound.
 float getDistance()
           
 Ray getRay()
           
 Geometry getTargetMesh()
          getTargetMesh returns the geometry that was hit by the ray.
 java.util.ArrayList<java.lang.Integer> getTargetTris()
           
 void setRay(Ray ray)
           
 void setTargetMesh(Geometry mesh)
          setTargetMesh sets the geometry hit by the ray.
 void setTargetTris(java.util.ArrayList<java.lang.Integer> target)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

distance

protected float distance
Constructor Detail

PickData

public PickData(Ray ray,
                Geometry targetMesh,
                boolean checkDistance)

PickData

public PickData(Ray ray,
                Geometry targetMesh,
                java.util.ArrayList<java.lang.Integer> targetTris,
                boolean checkDistance)
instantiates a new PickData object.

Method Detail

getTargetMesh

public Geometry getTargetMesh()
getTargetMesh returns the geometry that was hit by the ray.

Returns:
the geometry hit by the ray.

setTargetMesh

public void setTargetMesh(Geometry mesh)
setTargetMesh sets the geometry hit by the ray.

Parameters:
mesh - the geometry hit by the ray.

getTargetTris

public java.util.ArrayList<java.lang.Integer> getTargetTris()
Returns:
Returns the target.

setTargetTris

public void setTargetTris(java.util.ArrayList<java.lang.Integer> target)
Parameters:
target - The target to set.

getRay

public Ray getRay()
Returns:
Returns the ray.

setRay

public void setRay(Ray ray)
Parameters:
ray - The ray to set.

getDistance

public float getDistance()

calculateDistance

protected float calculateDistance()
For bounds picking this method returns the distance of the ray origin to the bound. For triangle picking the it should return the distance to the closest hit triangle.

Returns:
distance to the target