Improvement: Inverse Kinematics now breaks the iteration if the computed
angle change drops below some minimal level.
This commit is contained in:
parent
4992eba850
commit
483156f2ba
@ -26,6 +26,7 @@ import com.jme3.scene.plugins.blender.math.Vector3d;
|
||||
*/
|
||||
public class ConstraintDefinitionIK extends ConstraintDefinition {
|
||||
private static final float MIN_DISTANCE = 0.001f;
|
||||
private static final float MIN_ANGLE_CHANGE = 0.001f;
|
||||
private static final int FLAG_USE_TAIL = 0x01;
|
||||
private static final int FLAG_POSITION = 0x20;
|
||||
|
||||
@ -117,7 +118,9 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
||||
Matrix J_1 = J.pseudoinverse();
|
||||
|
||||
SimpleMatrix deltaThetas = J_1.mult(deltaP);
|
||||
|
||||
if (deltaThetas.elementMaxAbs() < MIN_ANGLE_CHANGE) {
|
||||
break;
|
||||
}
|
||||
for (int j = 0; j < deltaThetas.numRows(); ++j) {
|
||||
double angle = deltaThetas.get(j, 0);
|
||||
Vector3d rotationVector = rotationVectors[j];
|
||||
|
Loading…
x
Reference in New Issue
Block a user