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, java.lang.Cloneable
Direct Known Subclasses:
DacLinks

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

    Fields 
    Modifier and Type Field Description
    static java.util.logging.Logger logger2
    message logger for this class
    static java.lang.String torsoName
    name for the ragdoll's torso, must not be used for any bone

    Fields inherited from class com.jme3.bullet.control.AbstractPhysicsControl

    added, logger
  • Method Summary

    Modifier and Type Method Description
    protected void addUnlinkedDescendants​(com.jme3.anim.Joint startJoint, java.util.Collection<com.jme3.anim.Joint> addResult)
    Add unlinked descendants of the specified Joint to the specified collection.
    protected void addUnlinkedDescendants​(com.jme3.animation.Bone startBone, java.util.Collection<com.jme3.animation.Bone> addResult)
    Add unlinked descendants of the specified Bone to the specified collection.
    void attach​(java.lang.String boneName, float mass, com.jme3.scene.Spatial model)
    Configure the specified model as an attachment.
    void attach​(java.lang.String boneName, LinkConfig config, com.jme3.scene.Spatial model)
    Configure the specified model as an attachment.
    LinkConfig attachmentConfig​(java.lang.String boneName)
    Access the configuration of the attachment link associated with the named bone.
    float attachmentMass​(java.lang.String boneName)
    Read the mass of the attachment associated with the named bone.
    void cloneFields​(com.jme3.util.clone.Cloner cloner, java.lang.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.
    LinkConfig config​(java.lang.String boneName)
    Access the configuration of the named bone/torso.
    int countAttachments()
    Count the attachments.
    int countLinkedBones()
    Count the linked bones.
    int countLinks()
    Count the links.
    float damping()
    Read the damping ratio for new rigid bodies.
    void detach​(java.lang.String boneName)
    Unlink the AttachmentLink associated with the named bone.
    float eventDispatchImpulseThreshold()
    Read the event-dispatch impulse threshold of this control.
    protected java.lang.String findManager​(com.jme3.anim.Joint startJoint)
    Find the manager of the specified armature joint.
    protected java.lang.String findManager​(com.jme3.animation.Bone startBone)
    Find the manager of the specified Bone.
    com.jme3.scene.Spatial getAttachmentModel​(java.lang.String boneName)
    Access the model attached to the named bone.
    RangeOfMotion getJointLimits​(java.lang.String boneName)
    Access the nominal range of motion for the joint connecting the named linked bone to its parent in the hierarchy.
    com.jme3.math.Vector3f gravity​(com.jme3.math.Vector3f storeResult)
    Copy this control's gravitational acceleration for Ragdoll mode.
    boolean hasAttachmentLink​(java.lang.String boneName)
    Test whether an AttachmentLink exists for the named bone.
    boolean hasBoneLink​(java.lang.String boneName)
    Test whether a BoneLink exists for the named bone.
    int ignoredHops()
    Determine the maximum number of physics-joint hops across which bodies ignore collisions.
    DacConfiguration jmeClone()
    Create a shallow clone for the JME cloner.
    void link​(java.lang.String boneName, float mass, RangeOfMotion rom)
    Link the named bone using the specified mass and range of motion.
    void link​(java.lang.String boneName, LinkConfig config, RangeOfMotion rom)
    Link the named bone using the specified configuration and range of motion.
    java.lang.String[] listAttachmentBoneNames()
    Enumerate bones with attachment links.
    java.lang.String[] listLinkedBoneNames()
    Enumerate bones with bone links.
    protected java.lang.String[] managerMap​(com.jme3.anim.Armature armature)
    Create a map from joint indices to the names of the armature joints that manage them.
    protected java.lang.String[] managerMap​(com.jme3.animation.Skeleton skeleton)
    Create a map from bone indices to the names of the bones that manage them.
    float mass​(java.lang.String boneName)
    Read the mass of the named bone/torso.
    void read​(com.jme3.export.JmeImporter importer)
    De-serialize this Control from the specified importer, for example when loading from a J3O file.
    void render​(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
    Render this control.
    void setApplyPhysicsLocal​(boolean applyPhysicsLocal)
    Alter whether physics-space coordinates should match the spatial's local coordinates.
    void setAttachmentConfig​(java.lang.String boneName, LinkConfig config)
    Alter the configuration of the attachment associated with the named bone.
    void setAttachmentMass​(java.lang.String boneName, float mass)
    Alter the mass of the attachment associated with the named bone.
    void setConfig​(java.lang.String boneName, LinkConfig config)
    Alter the configuration of the named bone/torso.
    void setDamping​(float dampingRatio)
    Alter the viscous damping ratio for new rigid bodies.
    void setEventDispatchImpulseThreshold​(float threshold)
    Alter the event-dispatch impulse threshold of this control.
    void setGravity​(com.jme3.math.Vector3f gravity)
    Alter this control's gravitational acceleration for Ragdoll mode.
    void setIgnoredHops​(int numHops)
    Alter the maximum number of physics-joint hops across which bodies will ignore collisions.
    void setJointLimits​(java.lang.String boneName, RangeOfMotion rom)
    Alter the range of motion of the joint connecting the named BoneLink to its parent in the link hierarchy.
    void setMass​(java.lang.String boneName, float mass)
    Alter the mass of the named bone/torso.
    float totalMass()
    Calculate the ragdoll's total mass, including attachments.
    void unlinkBone​(java.lang.String boneName)
    Unlink the BoneLink of the named bone.
    void write​(com.jme3.export.JmeExporter exporter)
    Serialize this Control to the specified exporter, for example when saving to a J3O file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.jme3.scene.control.Control

    update
  • Field Details

    • logger2

      public static final java.util.logging.Logger logger2
      message logger for this class
    • torsoName

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

    • attach

      public void attach​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String boneName)
      Read 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​(java.lang.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()
      Read the damping ratio for new rigid bodies.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • detach

      public void detach​(java.lang.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()
      Read the event-dispatch impulse threshold of this control.
      Returns:
      the threshold value (≥0)
    • getAttachmentModel

      public com.jme3.scene.Spatial getAttachmentModel​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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:
      setJointLimits(java.lang.String, com.jme3.bullet.animation.RangeOfMotion)
    • link

      public void link​(java.lang.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:
      setJointLimits(java.lang.String, com.jme3.bullet.animation.RangeOfMotion)
    • listAttachmentBoneNames

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

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

      public float mass​(java.lang.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) or NaN if undetermined
    • setAttachmentConfig

      public void setAttachmentConfig​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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, including attachments.
      Returns:
      the total mass (>0) or NaN if undetermined
    • unlinkBone

      public void unlinkBone​(java.lang.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, java.util.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, java.util.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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, java.lang.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)
    • jmeClone

      public DacConfiguration jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface com.jme3.util.clone.JmeCloneable
      Overrides:
      jmeClone in class AbstractPhysicsControl
      Returns:
      a new instance
    • read

      public void read​(com.jme3.export.JmeImporter importer) throws java.io.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:
      java.io.IOException - from the importer
    • render

      public void render​(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
      Render this control. Invoked once per ViewPort per frame, provided the control is added to a scene. Should be invoked only by a subclass or by the RenderManager.
      Parameters:
      rm - the render manager (unused)
      vp - the view port to render (unused)
    • 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 java.io.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:
      java.io.IOException - from the exporter