|
|
@@ -1000,8 +1000,21 @@ public abstract class Spatial implements Savable, Cloneable, Collidable,
|
|
|
}else{
|
|
|
store.set(in);
|
|
|
}
|
|
|
- store.multLocal(worldTransform.getRotation().inverse());
|
|
|
+ Quaternion rotation = worldTransform.getRotation();
|
|
|
+ //can we be sure if the quaternion is normalized?
|
|
|
+ //if yes, the conjugate could be used, and the normalizing procedure skipped
|
|
|
+ //store.multLocal(-rotation.getX(), -rotation.getY(), -rotation.getZ(), rotation.getW();
|
|
|
+
|
|
|
+ //Second option is to normalize manually
|
|
|
+ float norm = rotation.norm();
|
|
|
+ store.multLocal(rotation.getX()*-norm, rotation.getY()*-norm, rotation.getZ()*-norm, rotation.getW()*norm);
|
|
|
return store;
|
|
|
+
|
|
|
+ //Third option is to temporarily change the parent's quaternion. More expensive then option 2,
|
|
|
+ //but produces more accurate results. compared to option 2. (Error still below 1e-6f)
|
|
|
+ //store.multLocal(rotation.inverseLocal());
|
|
|
+ //rotation.inverseLocal();
|
|
|
+ //return store;
|
|
|
}
|
|
|
|
|
|
/**
|