Math in setLocalTranslation

I’m looking for a mathematical discussion of setLocalTranslation. I’ve come up absolutely empty - even in a wide-open Google search. And nothing in the JME Wiki at all beyond people having difficulties.

Please point me to a real definition, not a textual arm waving. I have a math background and the math part is easy. The definitions are hard.

Nike

Not sure what you mean? There’s no math in setting local translation, it just modifies an internal vector.
Perhaps you mean how the world transform is derived? In that case, you can find it in Transform.combineWithParent():

Momoko_Fan

Looking at the source code references, and the Spatial.java source as well, and piecing it together…

The Spatial class has ‘LocalTransform’ and ‘WorldTransform’ members. These are instances of the ‘Transform’ class.

The ‘Transform’ class has a displacement vector member, a Quaternion rotation member and a scale member.

setLocalTranslation sets the vector value of the translation vector inside the localTransform member inside the Spatial class.

The spatial.java file gives:
public void setLocalTranslation(float x, float y, float z) {
this.localTransform.setTranslation(x, y, z);
setTransformRefresh();
}


Okay, so now I must guess that the local translation is applied to position-rotate-scale the spatial with respect to the parent node. That’s different than I had imagined.

Thanks
Nike

That’s precisely what a scene graph is, though.

This might help bring you up to speed on what a scene graph is and explain a bit about relative transforms in the process:
http://wiki.jmonkeyengine.org/doku.php/jme3:scenegraph_for_dummies

1 Like