Class PxRigidBodyExt

java.lang.Object
physx.NativeObject
physx.extensions.PxRigidBodyExt

public class PxRigidBodyExt extends NativeObject
utility functions for use with PxRigidBody and subclasses
See Also:
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxRigidBodyExt

      protected PxRigidBodyExt()
    • PxRigidBodyExt

      protected PxRigidBodyExt(long address)
  • Method Details

    • wrapPointer

      public static PxRigidBodyExt wrapPointer(long address)
    • arrayGet

      public static PxRigidBodyExt arrayGet(long baseAddress, int index)
    • destroy

      public void destroy()
    • updateMassAndInertia

      public static boolean updateMassAndInertia(PxRigidBody body, float density)
      Computation of mass properties for a rigid body actor

      See previous method for details.

      \param[in,out] body The rigid body.

      Parameters:
      density - The density of the body. Used to compute the mass of the body. The density must be greater than 0.
      Returns:
      Boolean. True on success else false.
    • updateMassAndInertia

      public static boolean updateMassAndInertia(PxRigidBody body, float density, PxVec3 massLocalPose)
      Computation of mass properties for a rigid body actor

      See previous method for details.

      \param[in,out] body The rigid body.

      Parameters:
      density - The density of the body. Used to compute the mass of the body. The density must be greater than 0.
      massLocalPose - The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
      Returns:
      Boolean. True on success else false.
    • updateMassAndInertia

      public static boolean updateMassAndInertia(PxRigidBody body, float density, PxVec3 massLocalPose, boolean includeNonSimShapes)
      Computation of mass properties for a rigid body actor

      See previous method for details.

      \param[in,out] body The rigid body.

      Parameters:
      density - The density of the body. Used to compute the mass of the body. The density must be greater than 0.
      massLocalPose - The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
      includeNonSimShapes - True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account.
      Returns:
      Boolean. True on success else false.
    • setMassAndUpdateInertia

      public static boolean setMassAndUpdateInertia(PxRigidBody body, float mass)
      Computation of mass properties for a rigid body actor

      This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass.

      If no collision shapes are found, the inertia tensor is set to (1,1,1)

      Parameters:
      mass - The mass of the body. Must be greater than 0.
      Returns:
      Boolean. True on success else false.
      See Also:
    • setMassAndUpdateInertia

      public static boolean setMassAndUpdateInertia(PxRigidBody body, float mass, PxVec3 massLocalPose)
      Computation of mass properties for a rigid body actor

      This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass.

      If no collision shapes are found, the inertia tensor is set to (1,1,1)

      Parameters:
      mass - The mass of the body. Must be greater than 0.
      massLocalPose - The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
      Returns:
      Boolean. True on success else false.
      See Also:
    • setMassAndUpdateInertia

      public static boolean setMassAndUpdateInertia(PxRigidBody body, float mass, PxVec3 massLocalPose, boolean includeNonSimShapes)
      Computation of mass properties for a rigid body actor

      This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass.

      If no collision shapes are found, the inertia tensor is set to (1,1,1)

      Parameters:
      mass - The mass of the body. Must be greater than 0.
      massLocalPose - The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
      includeNonSimShapes - True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account.
      Returns:
      Boolean. True on success else false.
      See Also:
    • addForceAtPos

      public static void addForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      See Also:
    • addForceAtPos

      public static void addForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      See Also:
    • addForceAtPos

      public static void addForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode, boolean wakeup)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      wakeup - Specify if the call should wake up the actor.
      See Also:
    • addForceAtLocalPos

      public static void addForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      See Also:
    • addForceAtLocalPos

      public static void addForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      See Also:
    • addForceAtLocalPos

      public static void addForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode, boolean wakeup)
      Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the global frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      wakeup - Specify if the call should wake up the actor.
      See Also:
    • addLocalForceAtPos

      public static void addLocalForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      See Also:
    • addLocalForceAtPos

      public static void addLocalForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      See Also:
    • addLocalForceAtPos

      public static void addLocalForceAtPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode, boolean wakeup)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the global frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      wakeup - Specify if the call should wake up the actor.
      See Also:
    • addLocalForceAtLocalPos

      public static void addLocalForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      See Also:
    • addLocalForceAtLocalPos

      public static void addLocalForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      See Also:
    • addLocalForceAtLocalPos

      public static void addLocalForceAtLocalPos(PxRigidBody body, PxVec3 force, PxVec3 pos, PxForceModeEnum mode, boolean wakeup)
      Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.

      Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

      Note: if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation

      ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

      Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

      Parameters:
      body - The rigid body to apply the force to.
      force - Force/impulse to add, defined in the local frame. Range: force vector
      pos - Position in the local frame to add the force at. Range: position vector
      mode - The mode to use when applying the force/impulse(see #PxForceMode).
      wakeup - Specify if the call should wake up the actor.
      See Also:
    • getVelocityAtPos

      public static PxVec3 getVelocityAtPos(PxRigidBody body, PxVec3 pos)
      Computes the velocity of a point given in world coordinates if it were attached to the specified body and moving with it.
      Parameters:
      body - The rigid body the point is attached to.
      pos - Position we wish to determine the velocity for, defined in the global frame. Range: position vector
      Returns:
      The velocity of point in the global frame.
    • getLocalVelocityAtLocalPos

      public static PxVec3 getLocalVelocityAtLocalPos(PxRigidBody body, PxVec3 pos)
      Computes the velocity of a point given in local coordinates if it were attached to the specified body and moving with it.
      Parameters:
      body - The rigid body the point is attached to.
      pos - Position we wish to determine the velocity for, defined in the local frame. Range: position vector
      Returns:
      The velocity of point in the local frame.
    • getVelocityAtOffset

      public static PxVec3 getVelocityAtOffset(PxRigidBody body, PxVec3 pos)
      Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the specified body and moving with it.
      Parameters:
      body - The rigid body the point is attached to.
      pos - Position (offset from the origin of the body) we wish to determine the velocity for, defined in the global frame. Range: position vector
      Returns:
      The velocity of point (offset from the origin of the body) in the global frame.
    • computeVelocityDeltaFromImpulse

      public static void computeVelocityDeltaFromImpulse(PxRigidBody body, PxVec3 impulsiveForce, PxVec3 impulsiveTorque, PxVec3 deltaLinearVelocity, PxVec3 deltaAngularVelocity)
      Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body.

      The rigid body is left unaffected unless a subsequent independent call is executed that actually applies the computed changes to velocity and angular velocity.

      Note: if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account.

      Parameters:
      body - The body under consideration.
      impulsiveForce - The impulsive force that would be applied to the specified rigid body.
      impulsiveTorque - The impulsive torque that would be applied to the specified rigid body.
      deltaLinearVelocity - The change in linear velocity that would arise if impulsiveForce was to be applied to the specified rigid body.
      deltaAngularVelocity - The change in angular velocity that would arise if impulsiveTorque was to be applied to the specified rigid body.
    • computeVelocityDeltaFromImpulse

      public static void computeVelocityDeltaFromImpulse(PxRigidBody body, PxTransform globalPose, PxVec3 point, PxVec3 impulse, float invMassScale, float invInertiaScale, PxVec3 deltaLinearVelocity, PxVec3 deltaAngularVelocity)
      Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account

      This function is useful for extracting the respective linear and angular velocity changes from a contact or joint when the mass/inertia ratios have been adjusted.

      Note: if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account.

      Parameters:
      body - The rigid body
      globalPose - The body's world space transform
      point - The point in world space where the impulse is applied
      impulse - The impulse vector in world space
      invMassScale - The inverse mass scale
      invInertiaScale - The inverse inertia scale
      deltaLinearVelocity - The linear velocity change
      deltaAngularVelocity - The angular velocity change
    • computeLinearAngularImpulse

      public static void computeLinearAngularImpulse(PxRigidBody body, PxTransform globalPose, PxVec3 point, PxVec3 impulse, float invMassScale, float invInertiaScale, PxVec3 linearImpulse, PxVec3 angularImpulse)
      Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account

      This function is useful for extracting the respective linear and angular impulses from a contact or joint when the mass/inertia ratios have been adjusted.

      Parameters:
      body - The rigid body
      globalPose - The body's world space transform
      point - The point in world space where the impulse is applied
      impulse - The impulse vector in world space
      invMassScale - The inverse mass scale
      invInertiaScale - The inverse inertia scale
      linearImpulse - The linear impulse
      angularImpulse - The angular impulse