You will need to multiply the Child_02 WorldMatrix by the Parent1 World
Inverse Matrix to get the correct transformation in the space of Parent1
I'm not sure how to go about it in cmds you probably will have to look into
OpenMaya where you have the option to multiply matrices.

Füzes Marcell
GER: +49 157 777 231 10 <+49%201577%207723110>
HUN: +36 30 960 4722 <+36%2030%20960%204722>
fuzes.marc...@gmail.com
fuzesmarcell.com

On 10 June 2018 at 20:37, Virbhadra Gupta <viru.gup...@gmail.com> wrote:

> hey,
>
> suppose i have to child objects child_01 & child_02 both are in
> different hierarchy.
>
> i want to match child_02's world transform (translation & rotation) to
> child_01.
>
> parent constraint is one option but do for lots of objects don't know it's
> a good idea or not.
>
> Other option:
>
> i can query child_02's world transform by xform but how can i transfer it
> to child_01
> by it be done by matrix ??
>
> i tried:
>
> matrix_01 = cmds.xform("child_02", q=True, ws=True, m=True)
> cmds.setAttr("child_01.worldMatrix", matrix_01, type="matrix")
>
> but it's not working.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/fd7fc5a1-17ff-4dcb-926a-
> 2070e3f0fd3d%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/fd7fc5a1-17ff-4dcb-926a-2070e3f0fd3d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CANC2f3TPtP1rs_Fmr%2B4PxrVPBRaDHj4LSdGLqCy96y_abZLmyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to