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 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

    • 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 Vector3f getLateralFrictionDir1(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 Vector3f getLateralFrictionDir2(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 Vector3f getLocalPointA(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 Vector3f getLocalPointB(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 Vector3f getNormalWorldOnB(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 Vector3f getPositionWorldOnA(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 Vector3f getPositionWorldOnB(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