Package com.jme3.bullet.animation
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
Configure a DynamicAnimControl and access its configuration.
This class is shared between JBullet and Native Bullet.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Logger
message logger for this classstatic final String
name for the ragdoll's torso, must not be used for any boneFields inherited from class com.jme3.bullet.control.AbstractPhysicsControl
added, applyLocal, enabled, space, spatial
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addUnlinkedDescendants
(Joint startBone, Collection<Joint> addResult) Add unlinked descendants of the specified bone to the specified collection.void
cloneFields
(Cloner cloner, Object original) Callback fromCloner
to convert this shallow-cloned control into a deep-cloned one, using the specified cloner and original to resolve copied fields.int
Count the linked bones.int
Count the links.float
damping()
Read the damping ratio for new rigid bodies.float
Read the event-dispatch impulse threshold of this control.protected String
findManager
(Joint startBone) Find the manager of the specified bone.getJointLimits
(String boneName) Access the nominal range of motion for the joint connecting the named linked bone to its parent in the hierarchy.Copy this control's gravitational acceleration for Ragdoll mode.boolean
hasBoneLink
(String boneName) Test whether a BoneLink exists for the named bone.jmeClone()
Create a shallow clone for the JME cloner.void
link
(String boneName, float mass, RangeOfMotion rom) Link the named bone using the specified mass and range of motion.String[]
Enumerate all bones with bone links.protected String[]
managerMap
(Armature skeleton) Create a map from bone indices to the names of the bones that manage them.float
Read the mass of the named bone/torso.void
read
(JmeImporter im) De-serialize this control, for example when loading from a J3O file.void
render
(RenderManager rm, ViewPort vp) Render this control.void
setApplyPhysicsLocal
(boolean applyPhysicsLocal) Alter whether physics-space coordinates should match the spatial's local coordinates.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
(Vector3f gravity) Alter this control's gravitational acceleration for Ragdoll mode.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.void
Alter the mass of the named bone/torso.float
Calculate the ragdoll's total mass.void
unlinkBone
(String boneName) Unlink the BoneLink of the named bone.void
write
(JmeExporter ex) Serialize this control, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.control.AbstractPhysicsControl
addPhysics, applyPhysicsTransform, cloneForSpatial, createSpatialData, getPhysicsSpace, getSpatial, getSpatialRotation, getSpatialTranslation, isApplyPhysicsLocal, isEnabled, removePhysics, removeSpatialData, setEnabled, setPhysicsLocation, setPhysicsRotation, setPhysicsSpace, setSpatial, update
-
Field Details
-
logger2
message logger for this class -
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
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
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
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
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
Enumerate all bones with bone links.- Returns:
- a new array of bone names (not null, may be empty)
-
mass
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
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
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
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
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
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
Find the manager of the specified bone.- Parameters:
startBone
- the bone (not null, unaffected)- Returns:
- a bone/torso name (not null)
-
managerMap
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
Callback fromCloner
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 interfaceJmeCloneable
- Overrides:
cloneFields
in classAbstractPhysicsControl
- 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
Create a shallow clone for the JME cloner.- Returns:
- a new instance
-
read
De-serialize this control, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractPhysicsControl
- Parameters:
im
- importer (not null)- Throws:
IOException
- from importer
-
render
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 interfaceControl
- Overrides:
render
in classAbstractPhysicsControl
- 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 classAbstractPhysicsControl
- Parameters:
applyPhysicsLocal
- true→match local coordinates, false→match world coordinates (default=false)
-
write
Serialize this control, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractPhysicsControl
- Parameters:
ex
- exporter (not null)- Throws:
IOException
- from exporter
-