From 27a7fde24d12b66b0eb46a1712b86dc2a09d2df8 Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Mon, 28 Oct 2013 17:32:24 +0000 Subject: [PATCH] Feature: added support for influence factor in IK constraint. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10854 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../constraints/definitions/ConstraintDefinitionIK.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionIK.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionIK.java index 0887426b3..ac172f8e5 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionIK.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionIK.java @@ -40,7 +40,7 @@ public class ConstraintDefinitionIK extends ConstraintDefinition { @Override public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) { - if (needToCompute) { + if (needToCompute && influence != 0) { ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class); BoneContext[] boneContexts = this.getBones(); float b = chainLength; @@ -73,6 +73,8 @@ public class ConstraintDefinitionIK extends ConstraintDefinition { } else { theta = vectorA.angleBetween(vectorC) - FastMath.acos(-(b * b - a * a - c * c) / (2 * a * c)); } + + theta *= influence; if (theta != 0) { Vector3f vectorR = vectorA.cross(vectorC);