erilaz
05-26-2008, 01:18 PM
I'm trying to parent a bunch of objects to a shape object when I move it, with the following:
when transform spinners change id:#spinnerRotate obj do
(
-- if the spinner object isn't already being affected
if tempObj != obj then
(
tempObj = obj
spinnerTransform = obj.transform.position
rotationGroup = #()
for i = 1 to cubeArray.count do
(
--if a cube is on the same z plane as the spinner object
if (cubeArray[i].transform.position.z) == (spinnerTransform.z) then
(
append rotationGroup cubeArray[i] --keep the group for later
append obj.children cubeArray[i] --parent the cube to the spinner
)
)
)
)
)
If I check the assignment with a print statement, it shows that the object is parented, but when I move the spinner object, it doesn't move the children, nor does it show any form of parenting has taken place in the properties dialog.
I've also tried to parent the other way, using:
cubeArray[i].parent = obj
Is this parenting only occuring in the when construct then being removed? I'm slightly confused.
I should add that a normal parenting process, such as
selection.parent = $Box01 works fine.
when transform spinners change id:#spinnerRotate obj do
(
-- if the spinner object isn't already being affected
if tempObj != obj then
(
tempObj = obj
spinnerTransform = obj.transform.position
rotationGroup = #()
for i = 1 to cubeArray.count do
(
--if a cube is on the same z plane as the spinner object
if (cubeArray[i].transform.position.z) == (spinnerTransform.z) then
(
append rotationGroup cubeArray[i] --keep the group for later
append obj.children cubeArray[i] --parent the cube to the spinner
)
)
)
)
)
If I check the assignment with a print statement, it shows that the object is parented, but when I move the spinner object, it doesn't move the children, nor does it show any form of parenting has taken place in the properties dialog.
I've also tried to parent the other way, using:
cubeArray[i].parent = obj
Is this parenting only occuring in the when construct then being removed? I'm slightly confused.
I should add that a normal parenting process, such as
selection.parent = $Box01 works fine.
