Class PhysicsCollisionEvent

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.PhysicsCollisionEvent
All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class PhysicsCollisionEvent extends NativePhysicsObject
Describe a point of contact between 2 collision objects in a PhysicsSpace, based on Bullet's btManifoldPoint.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class

    Fields inherited from class com.jme3.bullet.NativePhysicsObject

    loggerN
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate an event.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Return the contact point's applied impulse (native field: m_appliedImpulse).
    float
    Return the contact point's applied lateral impulse #1 (native field: m_appliedImpulseLateral1).
    float
    Return the contact point's applied lateral impulse #2 (native field: m_appliedImpulseLateral2).
    float
    Return the contact point's combined friction, which is usually the product of the collision-object frictions (native field: m_combinedFriction).
    float
    Return the contact point's combined restitution, which is usually the product of the collision-object restitutions (native field: m_combinedRestitution).
    float
    Return the contact point's combined rolling friction (native field: m_combinedRollingFriction).
    float
    Return the contact point's combined spinning friction (native field: m_combinedSpinningFriction).
    float
    Return the contact point's signed separation distance (native field: m_distance1).
    int
    Return the contact-point flags (native field: m_contactPointFlags).
    int
    Return the triangle index in the shape of object A at the point of contact (native field: m_index0).
    int
    Return the triangle index in the shape of object B at the point of contact (native field: m_index1).
    com.jme3.math.Vector3f
    getLateralFrictionDir1(com.jme3.math.Vector3f storeResult)
    Return the contact point's lateral friction direction #1 (native field: m_lateralFrictionDir1).
    com.jme3.math.Vector3f
    getLateralFrictionDir2(com.jme3.math.Vector3f storeResult)
    Return the contact point's lateral friction direction #2 (native field: m_lateralFrictionDir2).
    int
    Return the contact point's lifetime (native name: m_lifeTime).
    com.jme3.math.Vector3f
    getLocalPointA(com.jme3.math.Vector3f storeResult)
    Return the contact point's location in the local coordinates of object A (native name: m_localPointA).
    com.jme3.math.Vector3f
    getLocalPointB(com.jme3.math.Vector3f storeResult)
    Return the contact point's location in the local coordinates of object B (native name: m_localPointB).
    com.jme3.scene.Spatial
    Access the user object of collision object A, provided it's a Spatial.
    com.jme3.scene.Spatial
    Access the user object of collision object B, provided it's a Spatial.
    com.jme3.math.Vector3f
    For compatibility with jme3-jbullet.
    com.jme3.math.Vector3f
    getNormalWorldOnB(com.jme3.math.Vector3f storeResult)
    Return the contact point's normal on object B in physics-space coordinates (native name: m_normalWorldOnB).
    Access collision object A.
    Access collision object B.
    int
    Return the part index in the shape of object A at the point of contact (native field: m_partId0).
    int
    Return the part index in the shape of object B at the point of contact (native field: m_partId1).
    com.jme3.math.Vector3f
    For compatibility with jme3-jbullet.
    com.jme3.math.Vector3f
    getPositionWorldOnA(com.jme3.math.Vector3f storeResult)
    Return the contact point's location on object A in physics-space coordinates (native field: m_positionWorldOnA).
    com.jme3.math.Vector3f
    For compatibility with jme3-jbullet.
    com.jme3.math.Vector3f
    getPositionWorldOnB(com.jme3.math.Vector3f storeResult)
    Return the contact point's location on object B in physics-space coordinates (native field: m_positionWorldOnB).
    boolean
    Test whether the contact point's lateral friction is initialized.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • PhysicsCollisionEvent

      public PhysicsCollisionEvent(PhysicsCollisionObject pcoA, PhysicsCollisionObject pcoB, long manifoldPointId)
      Instantiate an event.
      Parameters:
      pcoA - the first involved object (not null, alias created)
      pcoB - the 2nd involved object (not null, alias created)
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
  • Method Details

    • getNodeA

      public com.jme3.scene.Spatial getNodeA()
      Access the user object of collision object A, provided it's a Spatial. For compatibility with jme3-jbullet.
      Returns:
      the pre-existing Spatial, or null if none
    • getNodeB

      public com.jme3.scene.Spatial getNodeB()
      Access the user object of collision object B, provided it's a Spatial. For compatibility with jme3-jbullet.
      Returns:
      the pre-existing Spatial, or null if none
    • getObjectA

      public PhysicsCollisionObject getObjectA()
      Access collision object A.
      Returns:
      the pre-existing object (not null)
    • getObjectB

      public PhysicsCollisionObject getObjectB()
      Access collision object B.
      Returns:
      the pre-existing object (not null)
    • getAppliedImpulse

      public float getAppliedImpulse()
      Return the contact point's applied impulse (native field: m_appliedImpulse).
      Returns:
      the calculated impulse, or zero if the WarmStart bit is cleared in the solver mode
    • getAppliedImpulseLateral1

      public float getAppliedImpulseLateral1()
      Return the contact point's applied lateral impulse #1 (native field: m_appliedImpulseLateral1).
      Returns:
      the calculated impulse component
    • getAppliedImpulseLateral2

      public float getAppliedImpulseLateral2()
      Return the contact point's applied lateral impulse #2 (native field: m_appliedImpulseLateral2).
      Returns:
      the calculate impulse component
    • getCombinedFriction

      public float getCombinedFriction()
      Return the contact point's combined friction, which is usually the product of the collision-object frictions (native field: m_combinedFriction).
      Returns:
      the friction product
    • getCombinedRestitution

      public float getCombinedRestitution()
      Return the contact point's combined restitution, which is usually the product of the collision-object restitutions (native field: m_combinedRestitution).
      Returns:
      the restitution product
    • getCombinedRollingFriction

      public float getCombinedRollingFriction()
      Return the contact point's combined rolling friction (native field: m_combinedRollingFriction).
      Returns:
      the combined friction
    • getCombinedSpinningFriction

      public float getCombinedSpinningFriction()
      Return the contact point's combined spinning friction (native field: m_combinedSpinningFriction).
      Returns:
      the combined friction
    • getDistance1

      public float getDistance1()
      Return the contact point's signed separation distance (native field: m_distance1). This value is the negative of the penetration depth.
      Returns:
      the distance (in physics-space units)
    • getFlags

      public int getFlags()
      Return the contact-point flags (native field: m_contactPointFlags).
      Returns:
      a bitmask
      See Also:
    • getIndex0

      public int getIndex0()
      Return the triangle index in the shape of object A at the point of contact (native field: m_index0).

      If shape 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
    • getIndex1

      public int getIndex1()
      Return the triangle index in the shape of object B at the point of contact (native field: m_index1).

      If shape 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
    • getLateralFrictionDir1

      public com.jme3.math.Vector3f getLateralFrictionDir1(com.jme3.math.Vector3f storeResult)
      Return the contact point's lateral friction direction #1 (native field: m_lateralFrictionDir1).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a direction vector (either storeResult or a new instance)
    • getLateralFrictionDir2

      public com.jme3.math.Vector3f getLateralFrictionDir2(com.jme3.math.Vector3f storeResult)
      Return the contact point's lateral friction direction #2 (native field: m_lateralFrictionDir2).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a direction vector (either storeResult or a new instance)
    • getLifeTime

      public int getLifeTime()
      Return the contact point's lifetime (native name: m_lifeTime).
      Returns:
      the duration (in simulation steps, ≥0)
    • getLocalPointA

      public com.jme3.math.Vector3f getLocalPointA(com.jme3.math.Vector3f storeResult)
      Return the contact point's location in the local coordinates of object A (native name: m_localPointA).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (either storeResult or a new instance)
    • getLocalPointB

      public com.jme3.math.Vector3f getLocalPointB(com.jme3.math.Vector3f storeResult)
      Return the contact point's location in the local coordinates of object B (native name: m_localPointB).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (either storeResult or a new instance)
    • getNormalWorldOnB

      public com.jme3.math.Vector3f getNormalWorldOnB()
      For compatibility with jme3-jbullet.
      Returns:
      a new direction vector
    • getNormalWorldOnB

      public com.jme3.math.Vector3f getNormalWorldOnB(com.jme3.math.Vector3f storeResult)
      Return the contact point's normal on object B in physics-space coordinates (native name: m_normalWorldOnB).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a direction vector (either storeResult or a new instance)
    • getPartId0

      public int getPartId0()
      Return the part index in the shape of object A at the point of contact (native field: m_partId0).

      If the shape 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
    • getPartId1

      public int getPartId1()
      Return the part index in the shape of object B at the point of contact (native field: m_partId1).

      If the shape 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
    • getPositionWorldOnA

      public com.jme3.math.Vector3f getPositionWorldOnA()
      For compatibility with jme3-jbullet.
      Returns:
      a new location vector
    • getPositionWorldOnA

      public com.jme3.math.Vector3f getPositionWorldOnA(com.jme3.math.Vector3f storeResult)
      Return the contact point's location on object A in physics-space coordinates (native field: m_positionWorldOnA).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (either storeResult or a new instance)
    • getPositionWorldOnB

      public com.jme3.math.Vector3f getPositionWorldOnB()
      For compatibility with jme3-jbullet.
      Returns:
      a new location vector
    • getPositionWorldOnB

      public com.jme3.math.Vector3f getPositionWorldOnB(com.jme3.math.Vector3f storeResult)
      Return the contact point's location on object B in physics-space coordinates (native field: m_positionWorldOnB).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (either storeResult or a new instance)
    • isLateralFrictionInitialized

      public boolean isLateralFrictionInitialized()
      Test whether the contact point's lateral friction is initialized.
      Returns:
      true if initialized, otherwise false