public abstract class DacConfiguration extends AbstractPhysicsControl
This class is shared between JBullet and Native Bullet.
Modifier and Type | Field and 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
|
added, applyLocal, enabled, space, spatial
Modifier and Type | Method and Description |
---|---|
protected void |
addUnlinkedDescendants(Joint startBone,
java.util.Collection<Joint> addResult)
Add unlinked descendants of the specified bone to the specified
collection.
|
void |
cloneFields(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. |
int |
countLinkedBones()
Count the linked bones.
|
int |
countLinks()
Count the links.
|
float |
damping()
Read the damping ratio for new rigid bodies.
|
float |
eventDispatchImpulseThreshold()
Read the event-dispatch impulse threshold of this control.
|
protected java.lang.String |
findManager(Joint startBone)
Find the manager of the specified 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.
|
Vector3f |
gravity(Vector3f storeResult)
Copy this control's gravitational acceleration for Ragdoll mode.
|
boolean |
hasBoneLink(java.lang.String boneName)
Test whether a BoneLink exists for the named bone.
|
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.
|
java.lang.String[] |
listLinkedBoneNames()
Enumerate all bones with bone links.
|
protected java.lang.String[] |
managerMap(Armature 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(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(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.
|
void |
unlinkBone(java.lang.String boneName)
Unlink the BoneLink of the named bone.
|
void |
write(JmeExporter ex)
Serialize this control, for example when saving to a J3O file.
|
addPhysics, applyPhysicsTransform, cloneForSpatial, createSpatialData, getPhysicsSpace, getSpatial, getSpatialRotation, getSpatialTranslation, isApplyPhysicsLocal, isEnabled, removePhysics, removeSpatialData, setEnabled, setPhysicsLocation, setPhysicsRotation, setPhysicsSpace, setSpatial, update
public static final java.util.logging.Logger logger2
public static final java.lang.String torsoName
public int countLinkedBones()
public int countLinks()
public float damping()
public float eventDispatchImpulseThreshold()
public RangeOfMotion getJointLimits(java.lang.String boneName)
boneName
- the name of the linked bone (not null, not empty)public Vector3f gravity(Vector3f storeResult)
storeResult
- storage for the result (modified if not null)public boolean hasBoneLink(java.lang.String boneName)
boneName
- the name of the bone (may be null)public void link(java.lang.String boneName, float mass, RangeOfMotion rom)
Allowed only when the control is NOT added to a spatial.
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)setJointLimits(java.lang.String,
com.jme3.bullet.animation.RangeOfMotion)
public java.lang.String[] listLinkedBoneNames()
public float mass(java.lang.String boneName)
boneName
- the name of the bone/torso (not null)public void setDamping(float dampingRatio)
dampingRatio
- the desired damping ratio (non-negative, 0→no
damping, 1→critically damped, default=0.6)public void setEventDispatchImpulseThreshold(float threshold)
threshold
- the desired threshold (≥0)public void setGravity(Vector3f gravity)
gravity
- the desired acceleration vector (in physics-space
coordinates, not null, unaffected, default=0,-9.8,0)public void setJointLimits(java.lang.String boneName, RangeOfMotion rom)
boneName
- the name of the BoneLink (not null, not empty)rom
- the desired range of motion (not null)public void setMass(java.lang.String boneName, float mass)
boneName
- the name of the bone, or torsoName (not null)mass
- the desired mass (>0)public float totalMass()
public void unlinkBone(java.lang.String boneName)
Allowed only when the control is NOT added to a spatial.
boneName
- the name of the bone to unlink (not null, not empty)protected void addUnlinkedDescendants(Joint startBone, java.util.Collection<Joint> addResult)
startBone
- the starting bone (not null, unaffected)addResult
- the collection of bone names to append to (not null,
modified)protected java.lang.String findManager(Joint startBone)
startBone
- the bone (not null, unaffected)protected java.lang.String[] managerMap(Armature skeleton)
skeleton
- (not null, unaffected)public void cloneFields(Cloner cloner, java.lang.Object original)
Cloner
to convert this
shallow-cloned control into a deep-cloned one, using the specified cloner
and original to resolve copied fields.cloneFields
in interface JmeCloneable
cloneFields
in class AbstractPhysicsControl
cloner
- the cloner that's cloning this control (not null, modified)original
- the control from which this control was shallow-cloned
(not null, unaffected)public DacConfiguration jmeClone()
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class AbstractPhysicsControl
im
- importer (not null)java.io.IOException
- from importerpublic void render(RenderManager rm, ViewPort vp)
render
in interface Control
render
in class AbstractPhysicsControl
rm
- the render manager (not null)vp
- the view port to render (not null)public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
setApplyPhysicsLocal
in class AbstractPhysicsControl
applyPhysicsLocal
- true→match local coordinates,
false→match world coordinates (default=false)public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class AbstractPhysicsControl
ex
- exporter (not null)java.io.IOException
- from exporter