Does LocalRotation influence LocalTranslation?

Hello,



I have got three objects A, B, C. B is child spatial of A and C is child spatial of B.



A–>B–>C



A is positioned somewehere in 3D space.

B is positioned to A with setlocalTranslation

C is positioned to B with setlocalTranslation



Now I want to get the translationVector between A and C.



[java]



public static final Vector3f getTranslationRelativeTo(Spatial parent, Spatial child) {

return child.getWorldTranslation().subtract(parent.getWorldTranslation());

}



getTranslationRelativeTo(mySpatialA,mySpatialC)

[/java]



is this the correct way? Does the rotation of C relative to B and the rotation of B relative to A influence the result?



Thanks.



Regards,

Equi

You will miss out on rotations between them in that case. The best way is probably to go local to world on the child and then world to local on the parent.



http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Spatial.html#localToWorld(com.jme3.math.Vector3f,%20com.jme3.math.Vector3f)



http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Spatial.html#worldToLocal(com.jme3.math.Vector3f,%20com.jme3.math.Vector3f)