KinematicRagdollControl :
- Added possibility to tweak ccd motion threshold for the ragdoll, or for specific bones. - Added possibility to tweak ccd swept sphereradius for the ragdoll, or for specific bones. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7500 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
eb63ad11de
commit
fb28b20660
@ -126,7 +126,6 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
|
||||
protected float totalMass = 0;
|
||||
protected boolean added = false;
|
||||
|
||||
|
||||
public static enum Mode {
|
||||
|
||||
Kinetmatic,
|
||||
@ -234,7 +233,7 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
|
||||
tmpRot1.set(link.startBlendingRot);
|
||||
|
||||
//interpolating between ragdoll position/rotation and keyframed position/rotation
|
||||
tmpRot2.set(tmpRot1).slerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
|
||||
tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
|
||||
position2.set(position).interpolate(link.bone.getModelSpacePosition(), blendStart / blendTime);
|
||||
tmpRot1.set(tmpRot2);
|
||||
position.set(position2);
|
||||
@ -395,6 +394,7 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
|
||||
}
|
||||
|
||||
PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / (float) reccount);
|
||||
|
||||
shapeNode.setKinematic(mode == Mode.Kinetmatic);
|
||||
totalMass += rootMass / (float) reccount;
|
||||
|
||||
@ -809,4 +809,50 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
|
||||
public void setEventDispatchImpulseThreshold(float eventDispatchImpulseThreshold) {
|
||||
this.eventDispatchImpulseThreshold = eventDispatchImpulseThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CcdMotionThreshold of all the bone's rigidBodies of the ragdoll
|
||||
* @see PhysicsRigidBody#setCcdMotionThreshold(float)
|
||||
* @param value
|
||||
*/
|
||||
public void setCcdMotionThreshold(float value) {
|
||||
for (PhysicsBoneLink link : boneLinks.values()) {
|
||||
link.rigidBody.setCcdMotionThreshold(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CcdSweptSphereRadius of all the bone's rigidBodies of the ragdoll
|
||||
* @see PhysicsRigidBody#setCcdSweptSphereRadius(float)
|
||||
* @param value
|
||||
*/
|
||||
public void setCcdSweptSphereRadius(float value) {
|
||||
for (PhysicsBoneLink link : boneLinks.values()) {
|
||||
link.rigidBody.setCcdSweptSphereRadius(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CcdMotionThreshold of the given bone's rigidBodies of the ragdoll
|
||||
* @see PhysicsRigidBody#setCcdMotionThreshold(float)
|
||||
* @param value
|
||||
*/
|
||||
public void setBoneCcdMotionThreshold(String boneName, float value) {
|
||||
PhysicsBoneLink link = boneLinks.get(boneName);
|
||||
if (link != null) {
|
||||
link.rigidBody.setCcdMotionThreshold(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CcdSweptSphereRadius of the given bone's rigidBodies of the ragdoll
|
||||
* @see PhysicsRigidBody#setCcdSweptSphereRadius(float)
|
||||
* @param value
|
||||
*/
|
||||
public void setBoneCcdSweptSphereRadius(String boneName, float value) {
|
||||
PhysicsBoneLink link = boneLinks.get(boneName);
|
||||
if (link != null) {
|
||||
link.rigidBody.setCcdSweptSphereRadius(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user