[Closed] Rotating the parent is OK, but children do not rotate. Why?
The image shows the problem. How the script works:
- Based on the selected polygons, the script create the helpers objects with the proper dimensions – the width and the length of the polygons are used as width and length of the helpers.
- The position and rotation of those helpers are stored to the array with this code:
append arr #(helperName,pos, helperName.rot)
- After the array is filled, those helpers are deleted.
- New helpers are created to the world [0,0,0] with the proper dimensions and axis alignment. The boxes are placed inside the helpers and are linked to the helpers.
- One by one, the helpers is returned to their initial position with this code:
newHelperName.rot = arr[2]
newHelperName.pos = arr[1]
What happens:
6. The helpers are placed to the proper position
7. The helpers are rotated to the proper angle.
8. The boxes of the helper, that match the first selected polygon, are rotated properly
9. The boxes for all other helpers are placed properly, but they are not rotated properly, while the helper is rotated properly.
The code for collecting polygons, dimensions, position and rotation, creating new helpers, linking the boxes to helpers and returning the helpres to the initial position and rotation are the same for every helper. But, for some unknown for me reason, the final result is strange.
Did someone can help me?
Hey Kostadin
I don’t know which technique you use for alignment but maybe this can help
(
local dm, bx
lp = Plane dir:[.56,-.11,.83] pos:[50,80,200] length:100 width:100
in (dm = Dummy pos:[10,30,200]) (bx = Box dir:[.25,.30,-.55]pos:[-50,-80,100])
bx.transform = dm.transform = lp.transform
)
Without script how can we found bug ? Try check the pivot, I found a similar issue some time ago, the transformation operation (position + rotation ) are always related to local coordinates. As say gazybara, if the $.transform are different there are a wrong code, else the local coordinates of new box are different
If you’re parenting your boxes to their corresponding helper and the boxes are offset from their helpers, why not just do:
in coordsys parent myBox.rotation = [0,0,0]
Are you basing their position on the helper object you have created? perhaps the pivot or TM of that (despite looking in the correct position) is off. Seems that to use coordsys and rotation would need a quat value.
in coordsys $Rectangle01 $Box01.rotation = quat 1
$Box01.pos = $Rectangle01.pos
However i’d just set the transform property to the align object
Oops yeah my it would need a quat – obviously hadn’t had any coffee when i wrote my reply!
Thanks guys. I found and fix the problem – the created helpers was rotated before the boxes to be linked to them.