|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.bullet.control.KinematicRagdollControl
public class KinematicRagdollControl
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 physic space
This control creates collision shapes for each bones of the skeleton when you call spatial.addControl(ragdollControl).
There are 2 modes for this control :
Nested Class Summary | |
---|---|
static class |
KinematicRagdollControl.Mode
|
protected class |
KinematicRagdollControl.PhysicsBoneLink
|
Field Summary | |
---|---|
protected boolean |
added
|
protected PhysicsRigidBody |
baseRigidBody
|
protected boolean |
blendedControl
|
protected float |
blendStart
|
protected float |
blendTime
|
protected java.util.Map<java.lang.String,KinematicRagdollControl.PhysicsBoneLink> |
boneLinks
|
protected java.util.Set<java.lang.String> |
boneList
|
protected boolean |
debug
|
protected boolean |
enabled
|
protected float |
eventDispatchImpulseThreshold
|
protected Vector3f |
initScale
|
protected java.util.List<RagdollCollisionListener> |
listeners
|
protected static java.util.logging.Logger |
logger
|
protected KinematicRagdollControl.Mode |
mode
|
protected Vector3f |
modelPosition
|
protected Quaternion |
modelRotation
|
protected RagdollPreset |
preset
|
protected float |
rootMass
|
protected Skeleton |
skeleton
|
protected PhysicsSpace |
space
|
protected Spatial |
targetModel
|
protected float |
totalMass
|
protected float |
weightThreshold
|
Constructor Summary | |
---|---|
KinematicRagdollControl()
contruct a KinematicRagdollControl |
|
KinematicRagdollControl(float weightThreshold)
|
|
KinematicRagdollControl(RagdollPreset preset)
|
|
KinematicRagdollControl(RagdollPreset preset,
float weightThreshold)
|
Method Summary | |
---|---|
void |
addBoneName(java.lang.String name)
Add a bone name to this control Using this method you can specify which bones of the skeleton will be used to build the collision shapes. |
void |
addCollisionListener(RagdollCollisionListener listener)
add a |
protected void |
attachDebugShape(AssetManager manager)
|
void |
blendToKinematicMode(float blendTime)
Smoothly blend from Ragdoll mode to Kinematic mode This is useful to blend ragdoll actual position to a keyframe animation for example |
Control |
cloneForSpatial(Spatial spatial)
Creates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to. |
void |
collision(PhysicsCollisionEvent event)
For internal use only callback for collisionevent |
protected void |
detachDebugShape()
|
PhysicsRigidBody |
getBoneRigidBody(java.lang.String boneName)
return the rigidBody associated to the given bone |
float |
getEventDispatchImpulseThreshold()
|
SixDofJoint |
getJoint(java.lang.String boneName)
Return the joint between the given bone and its parent. |
KinematicRagdollControl.Mode |
getMode()
retruns the mode of this control |
PhysicsSpace |
getPhysicsSpace()
returns the physic space |
float |
getTotalMass()
|
float |
getWeightThreshold()
|
boolean |
isEnabled()
returns true if the control is enabled |
void |
read(JmeImporter im)
de-serialize this control |
void |
reBuild()
rebuild the ragdoll this is useful if you applied scale on the ragdoll after it's been initialized |
protected void |
removeFromPhysicsSpace()
|
void |
render(RenderManager rm,
ViewPort vp)
For internal use only specific render for the ragdoll(if debugging) |
void |
setBoneCcdMotionThreshold(java.lang.String boneName,
float value)
Deprecated. use getBoneRigidBody(String BoneName).setCcdMotionThreshold(float) instead |
void |
setBoneCcdSweptSphereRadius(java.lang.String boneName,
float value)
Deprecated. use getBoneRigidBody(String BoneName).setCcdSweptSphereRadius(float) instead |
void |
setCcdMotionThreshold(float value)
Set the CcdMotionThreshold of all the bone's rigidBodies of the ragdoll |
void |
setCcdSweptSphereRadius(float value)
Set the CcdSweptSphereRadius of all the bone's rigidBodies of the ragdoll |
void |
setEnabled(boolean enabled)
enable or disable the control note that if enabled is true and that the physic space has been set on the ragdoll, the ragdoll is added to the physic space if enabled is false the ragdoll is removed from physic space. |
void |
setEventDispatchImpulseThreshold(float eventDispatchImpulseThreshold)
|
void |
setJointLimit(java.lang.String boneName,
float maxX,
float minX,
float maxY,
float minY,
float maxZ,
float minZ)
Set the joint limits for the joint between the given bone and its parent. |
void |
setKinematicMode()
Set the control into Kinematic mode In theis mode, the collision shapes follow the movements of the skeleton, and can interact with physical environement |
protected void |
setMode(KinematicRagdollControl.Mode mode)
Enable or disable the ragdoll behaviour. |
void |
setPhysicsSpace(PhysicsSpace space)
set the physic space to this ragdoll |
void |
setRagdollMode()
Sets the control into Ragdoll mode The skeleton is entirely controlled by physics. |
void |
setRootMass(float rootMass)
|
void |
setSpatial(Spatial model)
|
void |
setWeightThreshold(float weightThreshold)
|
void |
update(float tpf)
Updates the control. |
void |
write(JmeExporter ex)
serialize this control |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.util.logging.Logger logger
protected java.util.Map<java.lang.String,KinematicRagdollControl.PhysicsBoneLink> boneLinks
protected Skeleton skeleton
protected PhysicsSpace space
protected boolean enabled
protected boolean debug
protected PhysicsRigidBody baseRigidBody
protected float weightThreshold
protected Spatial targetModel
protected Vector3f initScale
protected KinematicRagdollControl.Mode mode
protected boolean blendedControl
protected float blendTime
protected float blendStart
protected java.util.List<RagdollCollisionListener> listeners
protected float eventDispatchImpulseThreshold
protected RagdollPreset preset
protected java.util.Set<java.lang.String> boneList
protected Vector3f modelPosition
protected Quaternion modelRotation
protected float rootMass
protected float totalMass
protected boolean added
Constructor Detail |
---|
public KinematicRagdollControl()
public KinematicRagdollControl(float weightThreshold)
public KinematicRagdollControl(RagdollPreset preset, float weightThreshold)
public KinematicRagdollControl(RagdollPreset preset)
Method Detail |
---|
public void update(float tpf)
Control
update
in interface Control
tpf
- Time per frame.public Control cloneForSpatial(Spatial spatial)
Control
cloneForSpatial
in interface Control
public void reBuild()
public void setSpatial(Spatial model)
setSpatial
in interface Control
model
- the spatial to be controlled. This should not be called
from user code.public void addBoneName(java.lang.String name)
name
- public void setJointLimit(java.lang.String boneName, float maxX, float minX, float maxY, float minY, float maxZ, float minZ)
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 z axis (in radians)maxZ
- the maximum rotation on the z axis (in radians)minZ
- the minimum rotation on the z axis (in radians)public SixDofJoint getJoint(java.lang.String boneName)
boneName
- the name of the bone
protected void removeFromPhysicsSpace()
public void setEnabled(boolean enabled)
setEnabled
in interface PhysicsControl
enabled
- public boolean isEnabled()
protected void attachDebugShape(AssetManager manager)
protected void detachDebugShape()
public void render(RenderManager rm, ViewPort vp)
render
in interface Control
rm
- vp
- public void setPhysicsSpace(PhysicsSpace space)
setPhysicsSpace
in interface PhysicsControl
space
- public PhysicsSpace getPhysicsSpace()
getPhysicsSpace
in interface PhysicsControl
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
ex
-
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
im
-
java.io.IOException
public void collision(PhysicsCollisionEvent event)
collision
in interface PhysicsCollisionListener
event
- protected void setMode(KinematicRagdollControl.Mode mode)
ragdollEnabled
- public void blendToKinematicMode(float blendTime)
blendTime
- the blending time between ragdoll to anim.public void setKinematicMode()
public void setRagdollMode()
public KinematicRagdollControl.Mode getMode()
public void addCollisionListener(RagdollCollisionListener listener)
listener
- public void setRootMass(float rootMass)
public float getTotalMass()
public float getWeightThreshold()
public void setWeightThreshold(float weightThreshold)
public float getEventDispatchImpulseThreshold()
public void setEventDispatchImpulseThreshold(float eventDispatchImpulseThreshold)
public void setCcdMotionThreshold(float value)
value
- PhysicsRigidBody.setCcdMotionThreshold(float)
public void setCcdSweptSphereRadius(float value)
value
- PhysicsRigidBody.setCcdSweptSphereRadius(float)
@Deprecated public void setBoneCcdMotionThreshold(java.lang.String boneName, float value)
value
- PhysicsRigidBody.setCcdMotionThreshold(float)
@Deprecated public void setBoneCcdSweptSphereRadius(java.lang.String boneName, float value)
value
- PhysicsRigidBody.setCcdSweptSphereRadius(float)
public PhysicsRigidBody getBoneRigidBody(java.lang.String boneName)
boneName
- the name of the bone
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |