Child object transformation

Started by CarlosMB89, July 22, 2015, 03:25:45 PM

Previous topic - Next topic

CarlosMB89

Hello Olsen

My doubt is about world transformation matrix of child objects 3D.

I want to add an object (objectChild) with a specific orientation and position to another object (objectParent) which has been rotated and translated in the world space. My problem is that when I add my objectChild to the objectParent, the current position and orientation of the objectChild changes due to the tranformationMatrix of the objectParent.

Is there any way to add the objectChild and  doesn't change its position and orientation at the moment of adding it to the parent??

Thanks in advance.

EgonOlsen

That's the whole point of creating child/parent relations between objects. Why do you want to add an object child but don't apply the parent's transformations to it?

CarlosMB89

My case is that I have a robot with 6 articulation (objects) and each object is child of the previous one, so if I move one articulation the rest of the objects will move too.

What I want to do is to add an object to the end articulation(object), so it will move with the rest of articulations.

My problem is that when I add that object as a child of the end articulation, it is placed to another position and orientation different of the previous it  had before being added.

I don,t know how to avoid it.

Thanks

CarlosMB89

I want that when I add an object to the end articulation, it will be drawn with the previous orientation and in the center of the end articulation.

Gatobot14

why dont use bones?? using parent/child you have to position very careful your objects to get the desire rotations/tranlations,
with bones you only have to get the joint and move it

EgonOlsen

You could try to move your objects into position, then do something like


obj.translateMesh();
obj.rotateMesh();
obj.clearRotation();
obj.clearTranslation();
obj.build();


However, this also affects the rotation pivot and the center, so you might have to adjust these as well. But apart from that, I'm not sure why you have this problem in the first place. Maybe it helps to reverse the process, i.e. create all your child/parent relations and then move the objects to their position started with the first in the hierarchy and working your way down.

CarlosMB89

Thanks Egon

I reversed the position to the initial one and I add the new object. It worked.

Thanks