Package com.jme3.bullet.collision
Class PhysicsRayTestResult
java.lang.Object
com.jme3.bullet.collision.PhysicsRayTestResult
Represent the results of a Bullet ray test.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionAccess the collision object that was hit.float
Read the fraction of the ray's total length.com.jme3.math.Vector3f
For compatibility with jme3-jbullet.com.jme3.math.Vector3f
getHitNormalLocal
(com.jme3.math.Vector3f storeResult) Copy the normal vector at the point of contact.int
Read the part index at the point of contact.int
Read the triangle index at the point of contact.
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
getCollisionObject
Access the collision object that was hit.- Returns:
- the pre-existing instance (not null)
-
getHitFraction
public float getHitFraction()Read the fraction of the ray's total length.- Returns:
- fraction (from=0, to=1, ≥0, ≤1)
-
getHitNormalLocal
public com.jme3.math.Vector3f getHitNormalLocal()For compatibility with jme3-jbullet. The jme3-jbullet version returns a pre-existing vector instead of a new one.- Returns:
- a new unit vector
-
getHitNormalLocal
public com.jme3.math.Vector3f getHitNormalLocal(com.jme3.math.Vector3f storeResult) Copy the normal vector at the point of contact.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a unit vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
partIndex
public int partIndex()Read the part index at the point of contact.If shape that was hit is compound or convex, the index is undefined.
If the shape is a GImpactCollisionShape or MeshCollisionShape, the index identifies an IndexedMesh.
If the shape is a HeightfieldCollisionShape, the index identifies a grid row.
- Returns:
- the index of the collision-shape part (≥0) or -1 if undefined
-
triangleIndex
public int triangleIndex()Read the triangle index at the point of contact.If shape that was hit is convex, the index is undefined.
If shape is a CompoundCollisionShape, the index identifies a child shape.
If the shape is a GImpactCollisionShape or MeshCollisionShape, the index identifies a triangle in an IndexedMesh.
If the shape is a HeightfieldCollisionShape, the index indicates a grid column.
- Returns:
- the index of the collision-shape triangle (≥0) or -1 if undefined
-