Class ManifoldPoints

java.lang.Object
com.jme3.bullet.collision.ManifoldPoints

public final class ManifoldPoints extends Object
Utility class to access fields of Bullet's btManifoldPoint class.

Most fields are recomputed on every simulation step. To ensure that alterations persist, setters should be invoked from the contact-added callback.

Based on PhysicsCollisionEvent.

  • Field Summary

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

    Modifier and Type
    Method
    Description
    static long
    Create a manifold point (for testing) that will never be freed.
    static float
    getAppliedImpulse(long manifoldPointId)
    Return the applied impulse of the specified point (native field: m_appliedImpulse).
    static float
    getAppliedImpulseLateral1(long manifoldPointId)
    Return the applied lateral impulse #1 of the specified point (native field: m_appliedImpulseLateral1).
    static float
    getAppliedImpulseLateral2(long manifoldPointId)
    Return the applied lateral impulse #2 of the specified point (native field: m_appliedImpulseLateral2).
    static float
    getCombinedFriction(long manifoldPointId)
    Return the combined friction of the specified point (native field: m_combinedFriction).
    static float
    getCombinedRestitution(long manifoldPointId)
    Return the combined restitution of the specified point, which is the product of the collision-object restitutions (native field: m_combinedRestitution).
    static float
    getCombinedRollingFriction(long manifoldPointId)
    Return the combined rolling friction of the specified point (native field: m_combinedRollingFriction).
    static float
    getCombinedSpinningFriction(long manifoldPointId)
    Return the combined spinning friction of the specified point (native field: m_combinedSpinningFriction).
    static float
    getContactMotion1(long manifoldPointId)
    Return the contact motion #1 of the specified point (native field: m_contactMotion1).
    static float
    getContactMotion2(long manifoldPointId)
    Return the contact motion #2 of the specified point (native field: m_contactMotion2).
    static float
    getDistance1(long manifoldPointId)
    Return the separation distance of the specified point (native field: m_distance1).
    static int
    getFlags(long manifoldPointId)
    Return the flags of the specified point (native field: m_contactPointFlags).
    static int
    getIndex0(long manifoldPointId)
    Return the triangle index from the shape of object A at the specified point of contact (native field: m_index0).
    static int
    getIndex1(long manifoldPointId)
    Return the triangle index from the shape of object B at the specified point of contact (native field: m_index1).
    static void
    getLateralFrictionDir1(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the lateral friction direction #1 of the specified point (native field: m_lateralFrictionDir1).
    static void
    getLateralFrictionDir2(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the lateral friction direction #2 of the specified point (native field: m_lateralFrictionDir2).
    static int
    getLifeTime(long manifoldPointId)
    Return the lifetime of the specified point (native name: m_lifeTime).
    static void
    getLocalPointA(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the location of the specified point in the local coordinates of object A (native name: m_localPointA).
    static void
    getLocalPointB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the location of the specified point in the local coordinates of object B (native name: m_localPointB).
    static void
    getNormalWorldOnB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the normal on object B of the specified point in physics-space coordinates (native name: m_normalWorldOnB).
    static int
    getPartId0(long manifoldPointId)
    Return the part index from the shape of object A at the specified point of contact (native field: m_partId0).
    static int
    getPartId1(long manifoldPointId)
    Return the part index from the shape of object B at the specified point of contact (native field: m_partId1).
    static void
    getPositionWorldOnA(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
    static void
    getPositionWorldOnADp(long manifoldPointId, com.simsilica.mathd.Vec3d storeVector)
    Determine the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
    static void
    getPositionWorldOnB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
    Determine the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).
    static void
    getPositionWorldOnBDp(long manifoldPointId, com.simsilica.mathd.Vec3d storeVector)
    Determine the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).
    static boolean
    Determine how many points are used to calculate the area of the convex hull of a contact point.
    static void
    setAppliedImpulse(long manifoldPointId, float impulse)
    Alter the applied impulse of the specified point (native field: m_appliedImpulse).
    static void
    setAppliedImpulseLateral1(long manifoldPointId, float impulse)
    Alter the applied lateral impulse #1 of the specified point (native field: m_appliedImpulseLateral1).
    static void
    setAppliedImpulseLateral2(long manifoldPointId, float impulse)
    Alter the applied lateral impulse #2 of the specified point (native field: m_appliedImpulseLateral2).
    static void
    setCombinedFriction(long manifoldPointId, float friction)
    Alter the combined friction of the specified point (native field: m_combinedFriction).
    static void
    setCombinedRestitution(long manifoldPointId, float restitution)
    Alter the combined restitution of the specified point (native field: m_combinedRestitution).
    static void
    setCombinedRollingFriction(long manifoldPointId, float friction)
    Alter the combined rolling friction of the specified point (native field: m_combinedRollingFriction).
    static void
    setCombinedSpinningFriction(long manifoldPointId, float friction)
    Alter the combined spinning friction of the specified point (native field: m_combinedSpinningFriction).
    static void
    setContactCalcArea3Points(boolean setting)
    Alter the number of points used to calculate the area of the convex hull of a contact point.
    static void
    setContactMotion1(long manifoldPointId, float motion)
    Alter the contact motion #1 of the specified point (native field: m_contactMotion1).
    static void
    setContactMotion2(long manifoldPointId, float motion)
    Alter the contact motion #2 of the specified point (native field: m_contactMotion2).
    static void
    setDistance1(long manifoldPointId, float distance)
    Alter the separation distance of the specified point (native field: m_distance1).
    static void
    setFlags(long manifoldPointId, int bitmask)
    Alter the flags of the specified point (native field: m_contactPointFlags).
    static void
    setLateralFrictionDir1(long manifoldPointId, com.jme3.math.Vector3f direction)
    Alter the lateral friction direction #1 of the specified point (native field: m_lateralFrictionDir1).
    static void
    setLateralFrictionDir2(long manifoldPointId, com.jme3.math.Vector3f direction)
    Alter the lateral friction direction #2 of the specified point (native field: m_lateralFrictionDir2).
    static void
    setLocalPointA(long manifoldPointId, com.jme3.math.Vector3f locationVector)
    Alter the location of the specified point in the local coordinates of object A (native name: m_localPointA).
    static void
    setLocalPointB(long manifoldPointId, com.jme3.math.Vector3f locationVector)
    Alter the location of the specified point in the local coordinates of object B (native name: m_localPointB).
    static void
    setNormalWorldOnB(long manifoldPointId, com.jme3.math.Vector3f normalVector)
    Alter the normal on object B of the specified point in physics-space coordinates (native name: m_normalWorldOnB).
    static void
    setPositionWorldOnA(long manifoldPointId, com.jme3.math.Vector3f locationVector)
    Alter the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
    static void
    setPositionWorldOnB(long manifoldPointId, com.jme3.math.Vector3f locationVector)
    Alter the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

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

    • createTestPoint

      public static long createTestPoint()
      Create a manifold point (for testing) that will never be freed. For internal use only.
      Returns:
      the native ID of a new btManifoldPoint (not zero)
    • getAppliedImpulse

      public static float getAppliedImpulse(long manifoldPointId)
      Return the applied impulse of the specified point (native field: m_appliedImpulse).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the impulse calculated during the previous simulation step, or zero if the WarmStart bit is cleared in the solver mode
    • getAppliedImpulseLateral1

      public static float getAppliedImpulseLateral1(long manifoldPointId)
      Return the applied lateral impulse #1 of the specified point (native field: m_appliedImpulseLateral1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the impulse
    • getAppliedImpulseLateral2

      public static float getAppliedImpulseLateral2(long manifoldPointId)
      Return the applied lateral impulse #2 of the specified point (native field: m_appliedImpulseLateral2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the impulse
    • getCombinedFriction

      public static float getCombinedFriction(long manifoldPointId)
      Return the combined friction of the specified point (native field: m_combinedFriction).

      This is calculated as pco0.friction * pco1.friction and clamped between -10 and +10. To override this calculation, invoke setCombinedFriction(long, float).

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the friction product (≥-10, ≤10)
    • getCombinedRestitution

      public static float getCombinedRestitution(long manifoldPointId)
      Return the combined restitution of the specified point, which is the product of the collision-object restitutions (native field: m_combinedRestitution). To override this calculation, invoke setCombinedRestitution(long, float).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the restitution product
    • getCombinedRollingFriction

      public static float getCombinedRollingFriction(long manifoldPointId)
      Return the combined rolling friction of the specified point (native field: m_combinedRollingFriction).

      This is calculated as pco0.rollingFriction * pco1.friction + pco1.rollingFriction * pco0.friction and clamped between -10 and +10. To override this calculation, invoke setCombinedRollingFriction(long, float).

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the combined rolling friction (≥-10, ≤10)
    • getCombinedSpinningFriction

      public static float getCombinedSpinningFriction(long manifoldPointId)
      Return the combined spinning friction of the specified point (native field: m_combinedSpinningFriction).

      This is calculated as pco0.spinningFriction * pco1.friction + pco1.spinningFriction * pco0.friction and clamped between -10 and +10. To override this calculation, invoke setCombinedSpinningFriction(long, float).

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the combined spinning friction (≥-10, ≤10)
    • getContactMotion1

      public static float getContactMotion1(long manifoldPointId)
      Return the contact motion #1 of the specified point (native field: m_contactMotion1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the motion
    • getContactMotion2

      public static float getContactMotion2(long manifoldPointId)
      Return the contact motion #2 of the specified point (native field: m_contactMotion2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the motion
    • getDistance1

      public static float getDistance1(long manifoldPointId)
      Return the separation distance of the specified point (native field: m_distance1). This is the negative of the penetration depth.
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the distance (in physics-space units)
    • getFlags

      public static int getFlags(long manifoldPointId)
      Return the flags of the specified point (native field: m_contactPointFlags).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      a bitmask
      See Also:
    • getIndex0

      public static int getIndex0(long manifoldPointId)
      Return the triangle index from the shape of object A at the specified 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.

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the index of the collision-shape triangle (≥0) or -1 if undefined
    • getIndex1

      public static int getIndex1(long manifoldPointId)
      Return the triangle index from the shape of object B at the specified 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.

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the index of the collision-shape triangle (≥0) or -1 if undefined
    • getLateralFrictionDir1

      public static void getLateralFrictionDir1(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the lateral friction direction #1 of the specified point (native field: m_lateralFrictionDir1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getLateralFrictionDir2

      public static void getLateralFrictionDir2(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the lateral friction direction #2 of the specified point (native field: m_lateralFrictionDir2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getLifeTime

      public static int getLifeTime(long manifoldPointId)
      Return the lifetime of the specified point (native name: m_lifeTime).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the duration (in simulation steps, ≥0)
    • getLocalPointA

      public static void getLocalPointA(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the location of the specified point in the local coordinates of object A (native name: m_localPointA).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getLocalPointB

      public static void getLocalPointB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the location of the specified point in the local coordinates of object B (native name: m_localPointB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getNormalWorldOnB

      public static void getNormalWorldOnB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the normal on object B of the specified point in physics-space coordinates (native name: m_normalWorldOnB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getPartId0

      public static int getPartId0(long manifoldPointId)
      Return the part index from the shape of object A at the specified 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.

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the index of the collision-shape part (≥0) or -1 if undefined
    • getPartId1

      public static int getPartId1(long manifoldPointId)
      Return the part index from the shape of object B at the specified 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.

      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      Returns:
      the index of the collision-shape part (≥0) or -1 if undefined
    • getPositionWorldOnA

      public static void getPositionWorldOnA(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getPositionWorldOnADp

      public static void getPositionWorldOnADp(long manifoldPointId, com.simsilica.mathd.Vec3d storeVector)
      Determine the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (not null, modified)
    • getPositionWorldOnB

      public static void getPositionWorldOnB(long manifoldPointId, com.jme3.math.Vector3f storeVector)
      Determine the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (modified if not null)
    • getPositionWorldOnBDp

      public static void getPositionWorldOnBDp(long manifoldPointId, com.simsilica.mathd.Vec3d storeVector)
      Determine the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      storeVector - storage for the result (modified if not null)
    • isContactCalcArea3Points

      public static boolean isContactCalcArea3Points()
      Determine how many points are used to calculate the area of the convex hull of a contact point.
      Returns:
      true if using 3 points (faster), false if using 4 points (more accurate)
    • setAppliedImpulse

      public static void setAppliedImpulse(long manifoldPointId, float impulse)
      Alter the applied impulse of the specified point (native field: m_appliedImpulse).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      impulse - the desired impulse
    • setAppliedImpulseLateral1

      public static void setAppliedImpulseLateral1(long manifoldPointId, float impulse)
      Alter the applied lateral impulse #1 of the specified point (native field: m_appliedImpulseLateral1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      impulse - the desired impulse
    • setAppliedImpulseLateral2

      public static void setAppliedImpulseLateral2(long manifoldPointId, float impulse)
      Alter the applied lateral impulse #2 of the specified point (native field: m_appliedImpulseLateral2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      impulse - the desired impulse
    • setCombinedFriction

      public static void setCombinedFriction(long manifoldPointId, float friction)
      Alter the combined friction of the specified point (native field: m_combinedFriction).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      friction - the desired friction
    • setCombinedRestitution

      public static void setCombinedRestitution(long manifoldPointId, float restitution)
      Alter the combined restitution of the specified point (native field: m_combinedRestitution).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      restitution - the desired restitution
    • setCombinedRollingFriction

      public static void setCombinedRollingFriction(long manifoldPointId, float friction)
      Alter the combined rolling friction of the specified point (native field: m_combinedRollingFriction).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      friction - the desired friction
    • setCombinedSpinningFriction

      public static void setCombinedSpinningFriction(long manifoldPointId, float friction)
      Alter the combined spinning friction of the specified point (native field: m_combinedSpinningFriction).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      friction - the combined friction
    • setContactCalcArea3Points

      public static void setContactCalcArea3Points(boolean setting)
      Alter the number of points used to calculate the area of the convex hull of a contact point.
      Parameters:
      setting - true to use 3 points (faster), false to use 4 points (more accurate) (default=true)
    • setContactMotion1

      public static void setContactMotion1(long manifoldPointId, float motion)
      Alter the contact motion #1 of the specified point (native field: m_contactMotion1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      motion - the desired motion
    • setContactMotion2

      public static void setContactMotion2(long manifoldPointId, float motion)
      Alter the contact motion #2 of the specified point (native field: m_contactMotion2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      motion - the desired motion
    • setDistance1

      public static void setDistance1(long manifoldPointId, float distance)
      Alter the separation distance of the specified point (native field: m_distance1). This is the negative of the penetration depth.
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      distance - the desired distance (in physics-space units)
    • setFlags

      public static void setFlags(long manifoldPointId, int bitmask)
      Alter the flags of the specified point (native field: m_contactPointFlags).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      bitmask - the desired bitmask
      See Also:
    • setLateralFrictionDir1

      public static void setLateralFrictionDir1(long manifoldPointId, com.jme3.math.Vector3f direction)
      Alter the lateral friction direction #1 of the specified point (native field: m_lateralFrictionDir1).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      direction - the desired direction (in physics-space coordinates, not null, unaffected)
    • setLateralFrictionDir2

      public static void setLateralFrictionDir2(long manifoldPointId, com.jme3.math.Vector3f direction)
      Alter the lateral friction direction #2 of the specified point (native field: m_lateralFrictionDir2).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      direction - the desired direction (in physics-space coordinates, not null, unaffected)
    • setLocalPointA

      public static void setLocalPointA(long manifoldPointId, com.jme3.math.Vector3f locationVector)
      Alter the location of the specified point in the local coordinates of object A (native name: m_localPointA).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      locationVector - the desired location (not null, unaffected)
    • setLocalPointB

      public static void setLocalPointB(long manifoldPointId, com.jme3.math.Vector3f locationVector)
      Alter the location of the specified point in the local coordinates of object B (native name: m_localPointB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      locationVector - the desired location (not null, unaffected)
    • setNormalWorldOnB

      public static void setNormalWorldOnB(long manifoldPointId, com.jme3.math.Vector3f normalVector)
      Alter the normal on object B of the specified point in physics-space coordinates (native name: m_normalWorldOnB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      normalVector - the desired normal (not null, unaffected)
    • setPositionWorldOnA

      public static void setPositionWorldOnA(long manifoldPointId, com.jme3.math.Vector3f locationVector)
      Alter the location of the specified point on object A in physics-space coordinates (native field: m_positionWorldOnA).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      locationVector - the desired location (not null, unaffected)
    • setPositionWorldOnB

      public static void setPositionWorldOnB(long manifoldPointId, com.jme3.math.Vector3f locationVector)
      Alter the location of the specified point on object B in physics-space coordinates (native field: m_positionWorldOnB).
      Parameters:
      manifoldPointId - the native ID of the btManifoldPoint (not zero)
      locationVector - the desired location (not null, unaffected)