Package physx.physics

Class PxConstraint


public class PxConstraint extends PxBase
A plugin class for implementing constraints
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxConstraint

      protected PxConstraint()
    • PxConstraint

      protected PxConstraint(long address)
  • Method Details

    • wrapPointer

      public static PxConstraint wrapPointer(long address)
    • arrayGet

      public static PxConstraint arrayGet(long baseAddress, int index)
    • getScene

      public PxScene getScene()
      Retrieves the scene which this constraint belongs to.
      Returns:
      Owner Scene. NULL if not part of a scene.
      See Also:
    • setActors

      public void setActors(PxRigidActor actor0, PxRigidActor actor1)
      Sets the actors for this constraint.
      Parameters:
      actor0 - a reference to the pointer for the first actor
      actor1 - a reference to the pointer for the second actor
      See Also:
    • markDirty

      public void markDirty()
      Notify the scene that the constraint shader data has been updated by the application
    • setFlags

      public void setFlags(PxConstraintFlags flags)
      Set the flags for this constraint
      Parameters:
      flags - the new constraint flags

      default: PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES

      See Also:
    • getFlags

      public PxConstraintFlags getFlags()
      Retrieve the flags for this constraint
      Returns:
      the constraint flags
      See Also:
    • setFlag

      public void setFlag(PxConstraintFlagEnum flag, boolean value)
      Set a flag for this constraint
      Parameters:
      flag - the constraint flag
      value - the new value of the flag
      See Also:
    • getForce

      public void getForce(PxVec3 linear, PxVec3 angular)
      Retrieve the constraint force most recently applied to maintain this constraint.

      Note: It is not allowed to use this method while the simulation is running (except during PxScene::collide(), in PxContactModifyCallback or in contact report callbacks).

      Parameters:
      linear - the constraint force
      angular - the constraint torque
    • isValid

      public boolean isValid()
      whether the constraint is valid.

      A constraint is valid if it has at least one dynamic rigid body or articulation link. A constraint that is not valid may not be inserted into a scene, and therefore a static actor to which an invalid constraint is attached may not be inserted into a scene.

      Invalid constraints arise only when an actor to which the constraint is attached has been deleted.

    • setBreakForce

      public void setBreakForce(float linear, float angular)
      Set the break force and torque thresholds for this constraint.

      If either the force or torque measured at the constraint exceed these thresholds the constraint will break.

      Parameters:
      linear - the linear break threshold
      angular - the angular break threshold
    • setMinResponseThreshold

      public void setMinResponseThreshold(float threshold)
      Set the minimum response threshold for a constraint row

      When using mass modification for a joint or infinite inertia for a jointed body, very stiff solver constraints can be generated which can destabilize simulation. Setting this value to a small positive value (e.g. 1e-8) will cause constraint rows to be ignored if very large changes in impulses will generate only small changes in velocity. When setting this value, also set PxConstraintFlag::eDISABLE_PREPROCESSING. The solver accuracy for this joint may be reduced.

      Parameters:
      threshold - the minimum response threshold
    • getMinResponseThreshold

      public float getMinResponseThreshold()
      Retrieve the constraint break force and torque thresholds
      Returns:
      the minimum response threshold for a constraint row