Class RagdollSettingsRef

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public final class RagdollSettingsRef extends Ref
A counted reference to a RagdollSettings object. (native type: Ref<RagdollSettings>)
  • Constructor Details

    • RagdollSettingsRef

      public RagdollSettingsRef()
      Instantiate an empty reference.
  • Method Details

    • addAdditionalConstraint

      public void addAdditionalConstraint(AdditionalConstraint constraint)
      Add the specified constraint.
      Parameters:
      constraint - (not null)
    • calculateBodyIndexToConstraintIndex

      public void calculateBodyIndexToConstraintIndex()
      Pre-calculate the map used by getBodyIndexToConstraintIndex().
    • calculateConstraintIndexToBodyIdxPair

      public void calculateConstraintIndexToBodyIdxPair()
      Pre-calculate the map used by getConstraintIndexToBodyIdxPair().
    • createRagdoll

      public Ragdoll createRagdoll(int groupId, long userData, PhysicsSystem physicsSystem)
      Generate a ragdoll instance from the settings, which are unaffected.
      Parameters:
      groupId - the collision group for the bodies
      userData - the desired user-data value
      physicsSystem - where to add the bodies and constraints (not null, modified)
      Returns:
      a new ragdoll instance, or null when out of bodies
    • disableParentChildCollisions

      public void disableParentChildCollisions()
      Create and add collision filters to all bodies in the ragdoll and configure them so parents and children don't collide.
    • getParts

      public Part[] getParts()
      Access the parts by way of a Java array. (native attribute: mParts)
      Returns:
      a new array of new JVM objects with pre-existing native objects assigned
    • getSkeleton

      public Skeleton getSkeleton()
      Access the skeleton. (native attribute: mSkeleton)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • resizeParts

      public void resizeParts(int numParts)
      Resize the parts array.
      Parameters:
      numParts - the desired number of parts (≥0)
    • saveBinaryState

      public void saveBinaryState(StreamOut stream, boolean saveShapes, boolean saveGroupFilter)
      Save the settings to the specified binary stream. The settings are unaffected.
      Parameters:
      stream - the stream to write to (not null)
      saveShapes - if true, save the shapes
      saveGroupFilter - if true, save the group filter
    • setSkeleton

      public void setSkeleton(Skeleton skeleton)
      Replace the skeleton. (native attribute: mSkeleton)
      Parameters:
      skeleton - the desired skeleton (not null)
    • sRestoreFromBinaryState

      public static RagdollResult sRestoreFromBinaryState(StreamIn stream)
      Read a ragdoll from the specified input stream.
      Parameters:
      stream - the stream to read from (not null)
      Returns:
      the result of the read (not null)
    • stabilize

      public boolean stabilize()
      Stabilize the constraints.
      Returns:
      true if successful, otherwise false
    • getPtr

      public RagdollSettings getPtr()
      Temporarily access the referenced RagdollSettings.
      Specified by:
      getPtr in class Ref
      Returns:
      a new JVM object with the pre-existing native object assigned
    • targetVa

      public long targetVa()
      Return the address of the native RagdollSettings. No objects are affected.
      Specified by:
      targetVa in interface ConstJoltPhysicsObject
      Overrides:
      targetVa in class JoltPhysicsObject
      Returns:
      a virtual address (not zero)
    • toRef

      public RagdollSettingsRef toRef()
      Create another counted reference to the native RagdollSettings.
      Specified by:
      toRef in class Ref
      Returns:
      a new JVM object with a new native object assigned