Feature: added support for influence factor in IK constraint.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10854 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
821d6b6aa3
commit
27a7fde24d
@ -40,7 +40,7 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
||||||
if (needToCompute) {
|
if (needToCompute && influence != 0) {
|
||||||
ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
|
ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
|
||||||
BoneContext[] boneContexts = this.getBones();
|
BoneContext[] boneContexts = this.getBones();
|
||||||
float b = chainLength;
|
float b = chainLength;
|
||||||
@ -74,6 +74,8 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
|||||||
theta = vectorA.angleBetween(vectorC) - FastMath.acos(-(b * b - a * a - c * c) / (2 * a * c));
|
theta = vectorA.angleBetween(vectorC) - FastMath.acos(-(b * b - a * a - c * c) / (2 * a * c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
theta *= influence;
|
||||||
|
|
||||||
if (theta != 0) {
|
if (theta != 0) {
|
||||||
Vector3f vectorR = vectorA.cross(vectorC);
|
Vector3f vectorR = vectorA.cross(vectorC);
|
||||||
boneWorldRotation.fromAngleAxis(theta, vectorR);
|
boneWorldRotation.fromAngleAxis(theta, vectorR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user