Package com.jme3.bullet.control
Class KinematicRagdollControl
java.lang.Object
com.jme3.bullet.control.AbstractPhysicsControl
com.jme3.bullet.control.KinematicRagdollControl
- All Implemented Interfaces:
PhysicsCollisionListener
,PhysicsControl
,Savable
,Control
,JmeCloneable
,Cloneable
@Deprecated
public class KinematicRagdollControl
extends AbstractPhysicsControl
implements PhysicsCollisionListener, JmeCloneable
Deprecated.
This control is still a WIP, use it at your own risk
To use this control you need a model with an AnimControl and a SkeletonControl.
This should be the case if you imported an animated model from Ogre or blender.
Note enabling/disabling the control add/removes it from the physics space
To use this control you need a model with an AnimControl and a SkeletonControl.
This should be the case if you imported an animated model from Ogre or blender.
Note enabling/disabling the control add/removes it from the physics space
This control creates collision shapes for all bones in the skeleton when you invoke spatial.addControl(ragdollControl).
- The shape is HullCollision shape based on the vertices associated with each bone and based on a tweakable weight threshold (see setWeightThreshold)
- If you
don't want each bone to be a collision shape, you can specify what bone to
use by using the addBoneName method
By using this method, bone that are not used to create a shape, are "merged" to their parent to create the collision shape.
There are 2 modes for this control :
- The kinematic modes
:
this is the default behavior, this means that the collision shapes of the body are able to interact with physics enabled objects. in this mode physics shapes follow the motion of the animated skeleton (for example animated by a key framed animation) this mode is enabled by calling setKinematicMode(); - The ragdoll modes:
To enable this behavior, you need to invoke the setRagdollMode() method. In this mode the character is entirely controlled by physics, so it will fall under the gravity and move if any force is applied to it.
This class is shared between JBullet and Native Bullet.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Deprecated.Enumerate joint-control modes for this control.class
Deprecated.Link a bone to a jointed rigid body. -
Field Summary
Modifier and TypeFieldDescriptionprotected final PhysicsRigidBody
Deprecated.protected boolean
Deprecated.protected float
Deprecated.protected float
Deprecated.blending interval for animations (in seconds, ≥0)protected final Map<String,
KinematicRagdollControl.PhysicsBoneLink> Deprecated.Deprecated.protected boolean
Deprecated.protected float
Deprecated.protected Vector3f
Deprecated.protected List<RagdollCollisionListener>
Deprecated.protected static final Logger
Deprecated.list of registered collision listenersprotected KinematicRagdollControl.Mode
Deprecated.protected final Vector3f
Deprecated.protected final Quaternion
Deprecated.protected RagdollPreset
Deprecated.protected float
Deprecated.protected Skeleton
Deprecated.skeleton being controlledprotected Spatial
Deprecated.model being controlledprotected float
Deprecated.accumulate total mass of ragdoll when control is added to a sceneprotected float
Deprecated.Fields inherited from class com.jme3.bullet.control.AbstractPhysicsControl
added, applyLocal, enabled, space, spatial
-
Constructor Summary
ConstructorDescriptionDeprecated.Instantiate an enabled control.KinematicRagdollControl
(float weightThreshold) Deprecated.Instantiate an enabled control with the specified weight threshold.KinematicRagdollControl
(RagdollPreset preset) Deprecated.Instantiate an enabled control with the specified preset.KinematicRagdollControl
(RagdollPreset preset, float weightThreshold) Deprecated.Instantiate an enabled control with the specified preset and weight threshold. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBoneName
(String name) Deprecated.Add a bone name to this control.void
addCollisionListener
(RagdollCollisionListener listener) Deprecated.Add a collision listener to this control.protected void
addPhysics
(PhysicsSpace space) Deprecated.Add all managed physics objects to the specified space.void
Deprecated.Ensure that user control is enabled for any bones used by inverse kinematics and disabled for any other bones.void
blendToKinematicMode
(float blendTime) Deprecated.Smoothly blend from Ragdoll mode to Kinematic mode This is useful to blend ragdoll actual position to a keyframe animation for exampleprotected void
boneRecursion
(Spatial model, Bone bone, PhysicsRigidBody parent, int recursionCount, Map<Integer, List<Float>> pointsMap) Deprecated.Generate a physics shape and bone links for the specified bone.void
collision
(PhysicsCollisionEvent event) Deprecated.For internal use only: callback for collision eventprotected void
createSpatialData
(Spatial model) Deprecated.Create spatial-dependent data.Deprecated.Access the named bone.getBoneRigidBody
(String boneName) Deprecated.Access the rigidBody associated with the named bone.float
Deprecated.Read the ragdoll's event-dispatch impulse threshold.float
Deprecated.Read the rotation speed for inverse kinematics.float
Deprecated.Read the distance threshold for inverse kinematics.Deprecated.Return the joint between the specified bone and its parent.float
Deprecated.Read the limb damping.getMode()
Deprecated.returns the mode of this controlfloat
Deprecated.Read the ragdoll's total mass.float
Deprecated.Read the ragdoll's weight threshold.jmeClone()
Deprecated.Create a shallow clone for the JME cloner.protected void
kinematicUpdate
(float tpf) Deprecated.Update this control in Kinematic mode, based on bone animation tracks.protected void
matchPhysicObjectToBone
(KinematicRagdollControl.PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) Deprecated.Alter the transforms of a rigidBody to match the transforms of a bone.protected void
ragDollUpdate
(float tpf) Deprecated.Update this control in Ragdoll mode, based on Bullet physics.void
read
(JmeImporter im) Deprecated.De-serialize this control, for example when loading from a J3O file.void
reBuild()
Deprecated.Rebuild the ragdoll.void
Deprecated.Remove all inverse-kinematics targets.void
removeIKTarget
(Bone bone) Deprecated.Remove the inverse-kinematics target for the specified bone.protected void
removePhysics
(PhysicsSpace space) Deprecated.Remove all managed physics objects from the specified space.protected void
removeSpatialData
(Spatial spat) Deprecated.Destroy spatial-dependent data.void
render
(RenderManager rm, ViewPort vp) Deprecated.Render this control.protected void
scanSpatial
(Spatial model) Deprecated.Generate physics shapes and bone links for the skeleton.void
setCcdMotionThreshold
(float value) Deprecated.Alter the CcdMotionThreshold of all rigid bodies in the ragdoll.void
setCcdSweptSphereRadius
(float value) Deprecated.Alter the CcdSweptSphereRadius of all rigid bodies in the ragdoll.void
setEventDispatchImpulseThreshold
(float eventDispatchImpulseThreshold) Deprecated.Alter the ragdoll's event-dispatch impulse threshold.void
Deprecated.Sets the control into Inverse Kinematics mode.void
setIkRotSpeed
(float ikRotSpeed) Deprecated.Alter the rotation speed for inverse kinematics.setIKTarget
(Bone bone, Vector3f worldPos, int chainLength) Deprecated.Add a target for inverse kinematics.void
setIKThreshold
(float IKThreshold) Deprecated.Alter the distance threshold for inverse kinematics.void
setJointLimit
(String boneName, float maxX, float minX, float maxY, float minY, float maxZ, float minZ) Deprecated.Alter the limits of the joint connecting the specified bone to its parent.void
Deprecated.Put the control into Kinematic mode.void
setLimbDampening
(float limbDampening) Deprecated.Alter the limb damping.protected void
Deprecated.Enable or disable the ragdoll behaviour.protected void
Deprecated.Translate the physics object to the specified location.protected void
setPhysicsRotation
(Quaternion quat) Deprecated.Rotate the physics object to the specified orientation.void
Deprecated.Sets the control into Ragdoll mode The skeleton is entirely controlled by physics.void
setRootMass
(float rootMass) Deprecated.Alter the ragdoll's root mass.void
setWeightThreshold
(float weightThreshold) Deprecated.Alter the ragdoll's weight threshold.void
update
(float tpf) Deprecated.Update this control.void
updateBone
(KinematicRagdollControl.PhysicsBoneLink link, float tpf, TempVars vars, Quaternion tmpRot1, Quaternion[] tmpRot2, Bone tipBone, Vector3f target, int depth, int maxDepth) Deprecated.Update a bone and its ancestors in IK mode.void
write
(JmeExporter ex) Deprecated.Serialize this control, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.control.AbstractPhysicsControl
applyPhysicsTransform, cloneFields, cloneForSpatial, getPhysicsSpace, getSpatial, getSpatialRotation, getSpatialTranslation, isApplyPhysicsLocal, isEnabled, setApplyPhysicsLocal, setEnabled, setPhysicsSpace, setSpatial
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jme3.util.clone.JmeCloneable
cloneFields
-
Field Details
-
logger
Deprecated.list of registered collision listeners -
listeners
Deprecated. -
boneList
Deprecated. -
boneLinks
Deprecated. -
modelPosition
Deprecated. -
modelRotation
Deprecated. -
baseRigidBody
Deprecated. -
targetModel
Deprecated.model being controlled -
skeleton
Deprecated.skeleton being controlled -
preset
Deprecated. -
initScale
Deprecated. -
mode
Deprecated. -
debug
protected boolean debugDeprecated. -
blendedControl
protected boolean blendedControlDeprecated. -
weightThreshold
protected float weightThresholdDeprecated. -
blendStart
protected float blendStartDeprecated. -
blendTime
protected float blendTimeDeprecated.blending interval for animations (in seconds, ≥0) -
eventDispatchImpulseThreshold
protected float eventDispatchImpulseThresholdDeprecated. -
rootMass
protected float rootMassDeprecated. -
totalMass
protected float totalMassDeprecated.accumulate total mass of ragdoll when control is added to a scene
-
-
Constructor Details
-
KinematicRagdollControl
public KinematicRagdollControl()Deprecated.Instantiate an enabled control. -
KinematicRagdollControl
public KinematicRagdollControl(float weightThreshold) Deprecated.Instantiate an enabled control with the specified weight threshold.- Parameters:
weightThreshold
- (>0, <1)
-
KinematicRagdollControl
Deprecated.Instantiate an enabled control with the specified preset and weight threshold.- Parameters:
preset
- (not null)weightThreshold
- (>0, <1)
-
KinematicRagdollControl
Deprecated.Instantiate an enabled control with the specified preset.- Parameters:
preset
- (not null)
-
-
Method Details
-
update
public void update(float tpf) Deprecated.Update this control. Invoked once per frame during the logical-state update, provided the control is added to a scene. Do not invoke directly from user code.- Specified by:
update
in interfaceControl
- Overrides:
update
in classAbstractPhysicsControl
- Parameters:
tpf
- the time interval between frames (in seconds, ≥0)
-
ragDollUpdate
protected void ragDollUpdate(float tpf) Deprecated.Update this control in Ragdoll mode, based on Bullet physics.- Parameters:
tpf
- the time interval between frames (in seconds, ≥0)
-
kinematicUpdate
protected void kinematicUpdate(float tpf) Deprecated.Update this control in Kinematic mode, based on bone animation tracks.- Parameters:
tpf
- the time interval between frames (in seconds, ≥0)
-
updateBone
public void updateBone(KinematicRagdollControl.PhysicsBoneLink link, float tpf, TempVars vars, Quaternion tmpRot1, Quaternion[] tmpRot2, Bone tipBone, Vector3f target, int depth, int maxDepth) Deprecated.Update a bone and its ancestors in IK mode. Note: recursive!- Parameters:
link
- the bone link for the affected bone (may be null)tpf
- the time interval between frames (in seconds, ≥0)vars
- unusedtmpRot1
- temporary storage used in calculations (not null)tmpRot2
- temporary storage used in calculations (not null)tipBone
- (not null)target
- the location target in model space (not null, unaffected)depth
- depth of the recursion (≥0)maxDepth
- recursion limit (≥0)
-
matchPhysicObjectToBone
protected void matchPhysicObjectToBone(KinematicRagdollControl.PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) Deprecated.Alter the transforms of a rigidBody to match the transforms of a bone. This is used to make the ragdoll follow animated motion in Kinematic mode- Parameters:
link
- the bone link connecting the bone and the rigidBodyposition
- temporary storage used in calculations (not null)tmpRot1
- temporary storage used in calculations (not null)
-
reBuild
public void reBuild()Deprecated.Rebuild the ragdoll. This is useful if you applied scale on the ragdoll after it was initialized. Same as re-attaching. -
createSpatialData
Deprecated.Create spatial-dependent data. Invoked when this control is added to a scene.- Specified by:
createSpatialData
in classAbstractPhysicsControl
- Parameters:
model
- the controlled spatial (not null)
-
removeSpatialData
Deprecated.Destroy spatial-dependent data. Invoked when this control is removed from a spatial.- Specified by:
removeSpatialData
in classAbstractPhysicsControl
- Parameters:
spat
- the previously controlled spatial (not null)
-
addBoneName
Deprecated.Add a bone name to this control. Repeated invocations of this method can be used to specify which bones to use when generating collision shapes.Not allowed after attaching the control.
- Parameters:
name
- the name of the bone to add
-
scanSpatial
Deprecated.Generate physics shapes and bone links for the skeleton.- Parameters:
model
- the spatial with the model's SkeletonControl (not null)
-
boneRecursion
protected void boneRecursion(Spatial model, Bone bone, PhysicsRigidBody parent, int recursionCount, Map<Integer, List<Float>> pointsMap) Deprecated.Generate a physics shape and bone links for the specified bone. Note: recursive!- Parameters:
model
- the spatial with the model's SkeletonControl (not null)bone
- the bone to be linked (not null)parent
- the body linked to the parent bone (not null)recursionCount
- depth of the recursion (≥1)pointsMap
- (not null)
-
setJointLimit
public void setJointLimit(String boneName, float maxX, float minX, float maxY, float minY, float maxZ, float minZ) Deprecated.Alter the limits of the joint connecting the specified bone to its parent. Can only be invoked after adding the control to a spatial.- Parameters:
boneName
- the name of the bonemaxX
- the maximum rotation on the X axis (in radians)minX
- the minimum rotation on the X axis (in radians)maxY
- the maximum rotation on the Y axis (in radians)minY
- the minimum rotation on the Y axis (in radians)maxZ
- the maximum rotation on the Z axis (in radians)minZ
- the minimum rotation on the Z axis (in radians)
-
getJoint
Deprecated.Return the joint between the specified bone and its parent. This return null if it's invoked before adding the control to a spatial- Parameters:
boneName
- the name of the bone- Returns:
- the joint between the given bone and its parent
-
setPhysicsLocation
Deprecated.Description copied from class:AbstractPhysicsControl
Translate the physics object to the specified location.- Specified by:
setPhysicsLocation
in classAbstractPhysicsControl
- Parameters:
vec
- desired location (not null, unaffected)
-
setPhysicsRotation
Deprecated.Description copied from class:AbstractPhysicsControl
Rotate the physics object to the specified orientation.- Specified by:
setPhysicsRotation
in classAbstractPhysicsControl
- Parameters:
quat
- desired orientation (not null, unaffected)
-
addPhysics
Deprecated.Description copied from class:AbstractPhysicsControl
Add all managed physics objects to the specified space.- Specified by:
addPhysics
in classAbstractPhysicsControl
- Parameters:
space
- which physics space to add to (not null)
-
removePhysics
Deprecated.Description copied from class:AbstractPhysicsControl
Remove all managed physics objects from the specified space.- Specified by:
removePhysics
in classAbstractPhysicsControl
- Parameters:
space
- which physics space to remove from (not null)
-
collision
Deprecated.For internal use only: callback for collision event- Specified by:
collision
in interfacePhysicsCollisionListener
- Parameters:
event
- (not null)
-
setMode
Deprecated.Enable or disable the ragdoll behaviour. if ragdollEnabled is true, the character motion will only be powered by physics else, the character will be animated by the keyframe animation, but will be able to physically interact with its physics environment- Parameters:
mode
- an enum value (not null)
-
blendToKinematicMode
public void blendToKinematicMode(float blendTime) Deprecated.Smoothly blend from Ragdoll mode to Kinematic mode This is useful to blend ragdoll actual position to a keyframe animation for example- Parameters:
blendTime
- the blending time between ragdoll to anim.
-
setKinematicMode
public void setKinematicMode()Deprecated.Put the control into Kinematic mode. In this mode, the collision shapes follow the movements of the skeleton while interacting with the physics environment. -
setRagdollMode
public void setRagdollMode()Deprecated.Sets the control into Ragdoll mode The skeleton is entirely controlled by physics. -
setIKMode
public void setIKMode()Deprecated.Sets the control into Inverse Kinematics mode. The affected bones are affected by IK. physics. -
getMode
Deprecated.returns the mode of this control- Returns:
- an enum value
-
addCollisionListener
Deprecated.Add a collision listener to this control.- Parameters:
listener
- (not null, alias created)
-
setRootMass
public void setRootMass(float rootMass) Deprecated.Alter the ragdoll's root mass.- Parameters:
rootMass
- the desired mass (≥0)
-
getTotalMass
public float getTotalMass()Deprecated.Read the ragdoll's total mass.- Returns:
- mass (≥0)
-
getWeightThreshold
public float getWeightThreshold()Deprecated.Read the ragdoll's weight threshold.- Returns:
- threshold
-
setWeightThreshold
public void setWeightThreshold(float weightThreshold) Deprecated.Alter the ragdoll's weight threshold.- Parameters:
weightThreshold
- the desired threshold
-
getEventDispatchImpulseThreshold
public float getEventDispatchImpulseThreshold()Deprecated.Read the ragdoll's event-dispatch impulse threshold.- Returns:
- threshold
-
setEventDispatchImpulseThreshold
public void setEventDispatchImpulseThreshold(float eventDispatchImpulseThreshold) Deprecated.Alter the ragdoll's event-dispatch impulse threshold.- Parameters:
eventDispatchImpulseThreshold
- desired threshold
-
setCcdMotionThreshold
public void setCcdMotionThreshold(float value) Deprecated.Alter the CcdMotionThreshold of all rigid bodies in the ragdoll.- Parameters:
value
- the desired threshold value (velocity, >0) or zero to disable CCD (default=0)- See Also:
-
setCcdSweptSphereRadius
public void setCcdSweptSphereRadius(float value) Deprecated.Alter the CcdSweptSphereRadius of all rigid bodies in the ragdoll.- Parameters:
value
- the desired radius of the sphere used for continuous collision detection (≥0)- See Also:
-
getBoneRigidBody
Deprecated.Access the rigidBody associated with the named bone.- Parameters:
boneName
- the name of the bone- Returns:
- the associated rigidBody.
-
render
Deprecated.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)
-
jmeClone
Deprecated.Create a shallow clone for the JME cloner.- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new control (not null)
-
setIKTarget
Deprecated.Add a target for inverse kinematics.- Parameters:
bone
- which bone the IK applies to (not null)worldPos
- the world coordinates of the goal (not null)chainLength
- number of bones in the chain- Returns:
- a new instance (not null, already added to ikTargets)
-
removeIKTarget
Deprecated.Remove the inverse-kinematics target for the specified bone.- Parameters:
bone
- which bone has the target (not null, modified)
-
removeAllIKTargets
public void removeAllIKTargets()Deprecated.Remove all inverse-kinematics targets. -
applyUserControl
public void applyUserControl()Deprecated.Ensure that user control is enabled for any bones used by inverse kinematics and disabled for any other bones. -
getIkRotSpeed
public float getIkRotSpeed()Deprecated.Read the rotation speed for inverse kinematics.- Returns:
- speed (≥0)
-
setIkRotSpeed
public void setIkRotSpeed(float ikRotSpeed) Deprecated.Alter the rotation speed for inverse kinematics.- Parameters:
ikRotSpeed
- the desired speed (≥0, default=7)
-
getIKThreshold
public float getIKThreshold()Deprecated.Read the distance threshold for inverse kinematics.- Returns:
- distance threshold
-
setIKThreshold
public void setIKThreshold(float IKThreshold) Deprecated.Alter the distance threshold for inverse kinematics.- Parameters:
IKThreshold
- the desired distance threshold (default=0.1)
-
getLimbDampening
public float getLimbDampening()Deprecated.Read the limb damping.- Returns:
- the viscous damping ratio (0→no damping, 1→critically damped)
-
setLimbDampening
public void setLimbDampening(float limbDampening) Deprecated.Alter the limb damping.- Parameters:
limbDampening
- the desired viscous damping ratio (0→no damping, 1→critically damped, default=0.6)
-
getBone
Deprecated.Access the named bone.- Parameters:
name
- which bone to access- Returns:
- the pre-existing instance, or null if not found
-
write
Deprecated.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
-
read
Deprecated.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
-