public class DacLinks extends DacConfiguration implements PhysicsTickListener
This class is shared between JBullet and Native Bullet.
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Logger |
logger3
message logger for this class
|
logger2, torsoName
added, applyLocal, enabled, space, spatial
Modifier and Type | Method and Description |
---|---|
protected void |
addPhysics(PhysicsSpace space)
Add all managed physics objects to the PhysicsSpace.
|
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. |
protected void |
createSpatialData(Spatial spatial)
Create spatial-dependent data.
|
Joint |
findBone(java.lang.String boneName)
Access the named bone.
|
BoneLink |
findBoneLink(java.lang.String boneName)
Access the BoneLink for the named bone.
|
PhysicsLink |
findLink(java.lang.String linkName)
Access the named link.
|
protected java.util.List<BoneLink> |
getBoneLinks()
Access the list of bone links in a pre-order, depth-first traversal of
the link hierarchy.
|
Armature |
getSkeleton()
Access the skeleton.
|
TorsoLink |
getTorsoLink()
Access the TorsoLink.
|
boolean |
isReady()
Test whether this control is ready for dynamic mode.
|
DacLinks |
jmeClone()
Create a shallow clone for the JME cloner.
|
<T extends PhysicsLink> |
listLinks(java.lang.Class<T> linkType)
Enumerate all physics links of the specified type managed by this
control.
|
PhysicsRigidBody[] |
listRigidBodies()
Enumerate all rigid bodies managed by this control.
|
float |
mass(java.lang.String boneName)
Read the mass of the named bone/torso.
|
void |
physicsTick(PhysicsSpace space,
float timeStep)
Callback from Bullet, invoked just after the physics has been stepped.
|
void |
prePhysicsTick(PhysicsSpace space,
float timeStep)
Callback from Bullet, invoked just before the physics is stepped.
|
void |
read(JmeImporter im)
De-serialize this control, for example when loading from a J3O file.
|
void |
rebuild()
Rebuild the ragdoll.
|
protected void |
removePhysics(PhysicsSpace space)
Remove all managed physics objects from the PhysicsSpace.
|
protected void |
removeSpatialData(Spatial spat)
Remove spatial-dependent data.
|
void |
setDamping(float dampingRatio)
Alter the viscous damping ratio for all rigid bodies, including new ones.
|
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(PhysicsLink link,
float mass)
Alter the mass of the specified link.
|
void |
setMass(java.lang.String boneName,
float mass)
Alter the mass of the named bone/torso.
|
protected void |
setPhysicsLocation(Vector3f vec)
Translate the torso to the specified location.
|
protected void |
setPhysicsRotation(Quaternion quat)
Rotate the torso to the specified orientation.
|
void |
update(float tpf)
Update this control.
|
protected void |
verifyAddedToSpatial(java.lang.String desiredAction)
Verify that this control is added to a Spatial.
|
void |
verifyReadyForDynamicMode(java.lang.String desiredAction)
Verify that this control is ready for dynamic mode, which implies that it
is added to a Spatial.
|
void |
write(JmeExporter ex)
Serialize this control, for example when saving to a J3O file.
|
addUnlinkedDescendants, countLinkedBones, countLinks, damping, eventDispatchImpulseThreshold, findManager, getJointLimits, gravity, hasBoneLink, link, listLinkedBoneNames, managerMap, render, setApplyPhysicsLocal, setEventDispatchImpulseThreshold, totalMass, unlinkBone
applyPhysicsTransform, cloneForSpatial, getPhysicsSpace, getSpatial, getSpatialRotation, getSpatialTranslation, isApplyPhysicsLocal, isEnabled, setEnabled, setPhysicsSpace, setSpatial
public static final java.util.logging.Logger logger3
public Joint findBone(java.lang.String boneName)
Allowed only when the control IS added to a spatial.
boneName
- the name of the skeleton bone to accesspublic BoneLink findBoneLink(java.lang.String boneName)
boneName
- the name of the bone (not null, not empty)public PhysicsLink findLink(java.lang.String linkName)
linkName
- the name of the link (not null, not empty)public Armature getSkeleton()
public TorsoLink getTorsoLink()
public boolean isReady()
public <T extends PhysicsLink> java.util.List<T> listLinks(java.lang.Class<T> linkType)
T
- subclass of PhysicsLinklinkType
- the subclass of PhysicsLink to search for (not null)public PhysicsRigidBody[] listRigidBodies()
Allowed only when the control IS added to a spatial.
public void rebuild()
Allowed only when the control IS added to a spatial.
public void setMass(PhysicsLink link, float mass)
link
- the link to modify (not null)mass
- the desired mass (>0)public void verifyReadyForDynamicMode(java.lang.String desiredAction)
desiredAction
- (not null, not empty)protected java.util.List<BoneLink> getBoneLinks()
protected void verifyAddedToSpatial(java.lang.String desiredAction)
desiredAction
- (not null, not empty)protected void addPhysics(PhysicsSpace space)
addPhysics
in class AbstractPhysicsControl
space
- which physics space to add to (not null)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 DacConfiguration
cloner
- the cloner that's cloning this control (not null, modified)original
- the control from which this control was shallow-cloned
(not null, unaffected)protected void createSpatialData(Spatial spatial)
rebuild()
.createSpatialData
in class AbstractPhysicsControl
spatial
- the controlled spatial (not null)public DacLinks jmeClone()
jmeClone
in interface JmeCloneable
jmeClone
in class DacConfiguration
public float mass(java.lang.String boneName)
mass
in class DacConfiguration
boneName
- the name of the bone/torso (not null)public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class DacConfiguration
im
- importer (not null)java.io.IOException
- from importerprotected void removePhysics(PhysicsSpace space)
removePhysics
in class AbstractPhysicsControl
space
- which physics space to remove from (not null)protected void removeSpatialData(Spatial spat)
removeSpatialData
in class AbstractPhysicsControl
spat
- the previously controlled spatial (unused)public void setDamping(float dampingRatio)
setDamping
in class DacConfiguration
dampingRatio
- the desired damping ratio (non-negative, 0→no
damping, 1→critically damped, default=0.6)public void setGravity(Vector3f gravity)
setGravity
in class DacConfiguration
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)
setJointLimits
in class DacConfiguration
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)
setMass
in class DacConfiguration
boneName
- the name of the bone, or torsoName (not null)mass
- the desired mass (>0)protected void setPhysicsLocation(Vector3f vec)
setPhysicsLocation
in class AbstractPhysicsControl
vec
- desired location (not null, unaffected)protected void setPhysicsRotation(Quaternion quat)
setPhysicsRotation
in class AbstractPhysicsControl
quat
- desired orientation (not null, unaffected)public void update(float tpf)
update
in interface Control
update
in class AbstractPhysicsControl
tpf
- the time interval between frames (in seconds, ≥0)public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class DacConfiguration
ex
- exporter (not null)java.io.IOException
- from exporterpublic void physicsTick(PhysicsSpace space, float timeStep)
physicsTick
in interface PhysicsTickListener
space
- the space that was just stepped (not null)timeStep
- the time per physics step (in seconds, ≥0)public void prePhysicsTick(PhysicsSpace space, float timeStep)
prePhysicsTick
in interface PhysicsTickListener
space
- the space that is about to be stepped (not null)timeStep
- the time per physics step (in seconds, ≥0)