Transform regardsless of earlier transformation or rotation

Started by ErDetEnAnd?, September 04, 2008, 01:21:30 PM

Previous topic - Next topic

ErDetEnAnd?

Hi.

I have 3 objects. 1 parent and 2 children. The parent should always be in the middle of the screen, and when clicking on a child, the clicked child center should transform to the parent center. The children share the same matrices, thus the children are transformed by same vector.

My approach only works when the objects are neither transformed nor rotated.
I calculate the subvector between the parent and the clicked child, then translates their matrix, but the result is dependant on ealier transformation and rotation. I dont think I have the correct understance of the two.

Where am I wrong?

EgonOlsen

You may reset rotations and transformations by doing something like:


Object3D.getRotationMatrix().setIdentity();

Object3D.getTranslationMatrix().setIdentity();


or, which is more correct when wearing the encapsulation glasses (but produces more overhead):


Object3D.setRotationMatrix(new Matrix());

Object3D.setTranslationMatrix(new Matrix());


Maybe this helps...