Bugfix: fixed NullPointerExceptions and IndexOutOfBoundExceptions in
Inverse Kinematics and several other constraints.
This commit is contained in:
parent
64b3be5334
commit
40c942ff66
@ -34,6 +34,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
|
||||
// distance limit does not work on bones who are connected to their parent
|
||||
return;
|
||||
}
|
||||
if(influence == 0 || targetTransform == null) {
|
||||
return ;// no need to do anything
|
||||
}
|
||||
|
||||
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
|
||||
|
||||
|
@ -53,12 +53,15 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
||||
|
||||
@Override
|
||||
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
||||
if (influence == 0 || !needToCompute) {
|
||||
if (influence == 0 || !needToCompute || targetTransform == null) {
|
||||
return;// no need to do anything
|
||||
}
|
||||
Quaternion q = new Quaternion();
|
||||
Vector3f t = targetTransform.getTranslation();
|
||||
List<BoneContext> bones = this.loadBones();
|
||||
if(bones.size() == 0) {
|
||||
return;// no need to do anything
|
||||
}
|
||||
float distanceFromTarget = Float.MAX_VALUE;
|
||||
|
||||
int iterations = this.iterations;
|
||||
|
@ -49,6 +49,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
|
||||
// location copy does not work on bones who are connected to their parent
|
||||
return;
|
||||
}
|
||||
if(influence == 0 || targetTransform == null) {
|
||||
return ;// no need to do anything
|
||||
}
|
||||
|
||||
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
|
||||
|
||||
|
@ -29,6 +29,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
|
||||
|
||||
@Override
|
||||
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
||||
if(influence == 0 || targetTransform == null) {
|
||||
return ;// no need to do anything
|
||||
}
|
||||
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
|
||||
|
||||
Quaternion ownerRotation = ownerTransform.getRotation();
|
||||
|
@ -32,6 +32,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
|
||||
|
||||
@Override
|
||||
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
||||
if(influence == 0 || targetTransform == null) {
|
||||
return;// no need to do anything
|
||||
}
|
||||
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
|
||||
|
||||
Vector3f ownerScale = ownerTransform.getScale();
|
||||
|
@ -35,6 +35,9 @@ public class ConstraintDefinitionTransLike extends ConstraintDefinition {
|
||||
|
||||
@Override
|
||||
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
|
||||
if(influence == 0 || targetTransform == null) {
|
||||
return ;// no need to do anything
|
||||
}
|
||||
Object target = this.getTarget();// Bone or Node
|
||||
Object owner = this.getOwner();// Bone or Node
|
||||
if (!target.getClass().equals(owner.getClass())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user