Class DacConfiguration

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

public abstract class DacConfiguration extends AbstractPhysicsControl
Configure a DynamicAnimControl and access its configuration.
  • 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:
  • Constructor Details

    • DacConfiguration

      protected DacConfiguration()
      Instantiate an enabled Control without any attachments or linked bones (torso only).
  • Method Details

    • attach

      public void attach(String boneName, float mass, com.jme3.scene.Spatial model)
      Configure the specified model as an attachment.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      mass - the desired mass of the model (>0)
      model - the model to attach (not null, orphan, alias created)
    • attach

      public void attach(String boneName, LinkConfig config, com.jme3.scene.Spatial model)
      Configure the specified model as an attachment.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      config - the desired configuration (not null)
      model - the model to attach (not null, orphan, alias created)
    • attachmentConfig

      public LinkConfig attachmentConfig(String boneName)
      Access the configuration of the attachment link associated with the named bone.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      Returns:
      the pre-existing configuration (not null)
    • attachmentMass

      public float attachmentMass(String boneName)
      Return the mass of the attachment associated with the named bone.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      Returns:
      the mass (in physics units, >0) or NaN if undetermined
    • config

      public LinkConfig config(String boneName)
      Access the configuration of the named bone/torso.
      Parameters:
      boneName - the name of the bone/torso (not null)
      Returns:
      the pre-existing configuration (not null)
    • countAttachments

      public int countAttachments()
      Count the attachments.
      Returns:
      count (≥0)
    • 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()
      Return the damping ratio for new rigid bodies.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • detach

      public void detach(String boneName)
      Unlink the AttachmentLink associated with the named bone.

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

      Parameters:
      boneName - the name of the associated bone (not null, not empty)
    • eventDispatchImpulseThreshold

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

      public com.jme3.scene.Spatial getAttachmentModel(String boneName)
      Access the model attached to the named bone.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      Returns:
      the orphan spatial (not null)
    • 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 com.jme3.math.Vector3f gravity(com.jme3.math.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)
    • hasAttachmentLink

      public boolean hasAttachmentLink(String boneName)
      Test whether an AttachmentLink exists for the named bone.
      Parameters:
      boneName - the name of the associated bone (may be null)
      Returns:
      true if found, otherwise false
    • 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
    • ignoredHops

      public int ignoredHops()
      Determine the maximum number of physics-joint hops across which bodies ignore collisions.
      Returns:
      the number of hops (≥0)
    • 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:
    • link

      public void link(String boneName, LinkConfig config, RangeOfMotion rom)
      Link the named bone using the specified configuration 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)
      config - the desired configuration (not null)
      rom - the desired range of motion (not null)
      See Also:
    • listAttachmentBoneNames

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

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

      public String mainBoneName()
      Return the name of the main bone.
      Returns:
      the name of the bone, or null if the main bone hasn't been determined yet
    • mass

      public float mass(String boneName)
      Return the mass of the named bone/torso.
      Parameters:
      boneName - the name of the bone/torso (not null)
      Returns:
      the mass (in physics units, >0) or NaN if undetermined
    • relativeTolerance

      public float relativeTolerance()
      Return the relative tolerance for comparing scale factors.
      Returns:
      the relative tolerance (≥0)
    • setAttachmentConfig

      public void setAttachmentConfig(String boneName, LinkConfig config)
      Alter the configuration of the attachment associated with the named bone.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      config - the desired configuration (not null)
    • setAttachmentMass

      public void setAttachmentMass(String boneName, float mass)
      Alter the mass of the attachment associated with the named bone.
      Parameters:
      boneName - the name of the associated bone (not null, not empty)
      mass - the desired mass (>0)
    • setConfig

      public void setConfig(String boneName, LinkConfig config)
      Alter the configuration of the named bone/torso.
      Parameters:
      boneName - the name of the bone, or torsoName (not null)
      config - the desired configuration (not null)
    • 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(com.jme3.math.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))
    • setIgnoredHops

      public void setIgnoredHops(int numHops)
      Alter the maximum number of physics-joint hops across which bodies will ignore collisions.

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

      Parameters:
      numHops - the desired number of hops (≥0, default=1)
    • 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)
    • setMainBoneName

      public void setMainBoneName(String boneName)
      Specify the main bone.
      Parameters:
      boneName - the name of the desired bone, or null to determine the main bone heuristically when the control is added to a spatial
    • 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)
    • setRelativeTolerance

      public void setRelativeTolerance(float newTolerance)
      Alter the relative tolerance for comparing scale factors.
      Parameters:
      newTolerance - the desired value (≥0, default=0.001)
    • totalMass

      public float totalMass()
      Calculate the ragdoll's total mass, including attachments.
      Returns:
      the total mass (>0) or NaN if undetermined
    • 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(com.jme3.animation.Bone startBone, Collection<com.jme3.animation.Bone> addResult)
      Add unlinked descendants of the specified Bone to the specified collection. Note: recursive!
      Parameters:
      startBone - the starting Bone (not null, aliases created)
      addResult - the collection of skeleton bones to append to (not null, modified)
    • addUnlinkedDescendants

      protected void addUnlinkedDescendants(com.jme3.anim.Joint startJoint, Collection<com.jme3.anim.Joint> addResult)
      Add unlinked descendants of the specified Joint to the specified collection. Note: recursive!
      Parameters:
      startJoint - the starting Joint (not null, aliases created)
      addResult - the collection of armature joints to append to (not null, modified)
    • findManager

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

      protected String findManager(com.jme3.anim.Joint startJoint)
      Find the manager of the specified armature joint.
      Parameters:
      startJoint - the joint (not null, unaffected)
      Returns:
      a joint/torso name (not null)
    • managerMap

      protected String[] managerMap(com.jme3.anim.Armature armature)
      Create a map from joint indices to the names of the armature joints that manage them.
      Parameters:
      armature - (not null, unaffected)
      Returns:
      a new array of joint/torso names (not null)
    • managerMap

      protected String[] managerMap(com.jme3.animation.Skeleton 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(com.jme3.util.clone.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 com.jme3.util.clone.JmeCloneable
      Overrides:
      cloneFields in class AbstractPhysicsControl
      Parameters:
      cloner - the Cloner that's cloning this Control (not null, modified)
      original - the instance from which this Control was shallow-cloned (not null, unaffected)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this Control from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class AbstractPhysicsControl
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • 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(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this Control to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class AbstractPhysicsControl
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter