Class DacConfiguration

java.lang.Object
com.jme3.bullet.control.AbstractPhysicsControl
com.jme3.bullet.animation.DacConfiguration
All Implemented Interfaces:
PhysicsControl, Savable, Control, JmeCloneable, Cloneable
Direct Known Subclasses:
DacLinks

public abstract class DacConfiguration extends AbstractPhysicsControl
Configure a DynamicAnimControl and access its configuration.

This class is shared between JBullet and Native Bullet.

  • Field Details

    • logger2

      public static final Logger logger2
      message logger for this class
    • torsoName

      public static final String torsoName
      name for the ragdoll's torso, must not be used for any bone
      See Also:
  • Method Details

    • countLinkedBones

      public int countLinkedBones()
      Count the linked bones.
      Returns:
      count (≥0)
    • countLinks

      public int countLinks()
      Count the links.
      Returns:
      count (≥0)
    • damping

      public float damping()
      Read the damping ratio for new rigid bodies.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • eventDispatchImpulseThreshold

      public float eventDispatchImpulseThreshold()
      Read the event-dispatch impulse threshold of this control.
      Returns:
      the threshold value (≥0)
    • getJointLimits

      public RangeOfMotion getJointLimits(String boneName)
      Access the nominal range of motion for the joint connecting the named linked bone to its parent in the hierarchy.
      Parameters:
      boneName - the name of the linked bone (not null, not empty)
      Returns:
      the pre-existing instance (not null)
    • gravity

      public Vector3f gravity(Vector3f storeResult)
      Copy this control's gravitational acceleration for Ragdoll mode.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      an acceleration vector (in physics-space coordinates, either storeResult or a new vector, not null)
    • hasBoneLink

      public boolean hasBoneLink(String boneName)
      Test whether a BoneLink exists for the named bone.
      Parameters:
      boneName - the name of the bone (may be null)
      Returns:
      true if found, otherwise false
    • link

      public void link(String boneName, float mass, RangeOfMotion rom)
      Link the named bone using the specified mass and range of motion.

      Allowed only when the control is NOT added to a spatial.

      Parameters:
      boneName - the name of the bone to link (not null, not empty)
      mass - the desired mass of the bone (>0)
      rom - the desired range of motion (not null)
      See Also:
    • listLinkedBoneNames

      public String[] listLinkedBoneNames()
      Enumerate all bones with bone links.
      Returns:
      a new array of bone names (not null, may be empty)
    • mass

      public float mass(String boneName)
      Read the mass of the named bone/torso.
      Parameters:
      boneName - the name of the bone/torso (not null)
      Returns:
      the mass (in physics units, >0)
    • setDamping

      public void setDamping(float dampingRatio)
      Alter the viscous damping ratio for new rigid bodies.
      Parameters:
      dampingRatio - the desired damping ratio (non-negative, 0→no damping, 1→critically damped, default=0.6)
    • setEventDispatchImpulseThreshold

      public void setEventDispatchImpulseThreshold(float threshold)
      Alter the event-dispatch impulse threshold of this control.
      Parameters:
      threshold - the desired threshold (≥0)
    • setGravity

      public void setGravity(Vector3f gravity)
      Alter this control's gravitational acceleration for Ragdoll mode.
      Parameters:
      gravity - the desired acceleration vector (in physics-space coordinates, not null, unaffected, default=0,-9.8,0)
    • setJointLimits

      public void setJointLimits(String boneName, RangeOfMotion rom)
      Alter the range of motion of the joint connecting the named BoneLink to its parent in the link hierarchy.
      Parameters:
      boneName - the name of the BoneLink (not null, not empty)
      rom - the desired range of motion (not null)
    • setMass

      public void setMass(String boneName, float mass)
      Alter the mass of the named bone/torso.
      Parameters:
      boneName - the name of the bone, or torsoName (not null)
      mass - the desired mass (>0)
    • totalMass

      public float totalMass()
      Calculate the ragdoll's total mass.
      Returns:
      the total mass (>0)
    • unlinkBone

      public void unlinkBone(String boneName)
      Unlink the BoneLink of the named bone.

      Allowed only when the control is NOT added to a spatial.

      Parameters:
      boneName - the name of the bone to unlink (not null, not empty)
    • addUnlinkedDescendants

      protected void addUnlinkedDescendants(Joint startBone, Collection<Joint> addResult)
      Add unlinked descendants of the specified bone to the specified collection. Note: recursive.
      Parameters:
      startBone - the starting bone (not null, unaffected)
      addResult - the collection of bone names to append to (not null, modified)
    • findManager

      protected String findManager(Joint startBone)
      Find the manager of the specified bone.
      Parameters:
      startBone - the bone (not null, unaffected)
      Returns:
      a bone/torso name (not null)
    • managerMap

      protected String[] managerMap(Armature skeleton)
      Create a map from bone indices to the names of the bones that manage them.
      Parameters:
      skeleton - (not null, unaffected)
      Returns:
      a new array of bone/torso names (not null)
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned control into a deep-cloned one, using the specified cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface JmeCloneable
      Overrides:
      cloneFields in class AbstractPhysicsControl
      Parameters:
      cloner - the cloner that's cloning this control (not null, modified)
      original - the control from which this control was shallow-cloned (not null, unaffected)
    • jmeClone

      public DacConfiguration jmeClone()
      Create a shallow clone for the JME cloner.
      Returns:
      a new instance
    • read

      public void read(JmeImporter im) throws IOException
      De-serialize this control, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      Overrides:
      read in class AbstractPhysicsControl
      Parameters:
      im - importer (not null)
      Throws:
      IOException - from importer
    • render

      public void render(RenderManager rm, ViewPort vp)
      Render this control. Invoked once per view port per frame, provided the control is added to a scene. Should be invoked only by a subclass or by the RenderManager.
      Specified by:
      render in interface Control
      Overrides:
      render in class AbstractPhysicsControl
      Parameters:
      rm - the render manager (not null)
      vp - the view port to render (not null)
    • setApplyPhysicsLocal

      public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
      Alter whether physics-space coordinates should match the spatial's local coordinates.
      Overrides:
      setApplyPhysicsLocal in class AbstractPhysicsControl
      Parameters:
      applyPhysicsLocal - true→match local coordinates, false→match world coordinates (default=false)
    • write

      public void write(JmeExporter ex) throws IOException
      Serialize this control, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      Overrides:
      write in class AbstractPhysicsControl
      Parameters:
      ex - exporter (not null)
      Throws:
      IOException - from exporter