Posted by: wil Mar 6 2007, 03:27 AM
Hi all,
I'm new to all this and just trying to get my head around targeting and transforming individual objects.
I want to create say, 5 cubes. Then I want to be able to select any one of them and move them individually of each other.
Any guidance would be greatly appreciated.
Thanks!!
Posted by: zeusprod Mar 6 2007, 02:56 PM
QUOTE(wil @ Mar 5 2007, 10:27 PM)

Hi all,
I'm new to all this and just trying to get my head around targeting and transforming individual objects.
I want to create say, 5 cubes. Then I want to be able to select any one of them and move them individually of each other.
Any guidance would be greatly appreciated.
Thanks!!
When
you add an object to the world, wrap it in a Transform3D as shown in
Petit's Tutorials
(http://www.petitpub.com/labs/media/flash/sandy/transformations.shtml).
Here
is some code showing translation (I removed the rotation for clarity).
It assume "cube" is an Box object and bg is the root group
// First we create the TransformationGroups
var tTrans:TransformGroup = new TransformGroup();
// We create Transform3D to carry out the transformation in 3 dimensions
var translation = new Transform3D();
// The translation is set in the transform group which will hold our cube
tTrans.setTransform( translation );
// The rotation is added to the translation
tTrans.addChild(cube );
// And finally the transformgroup is added as a child to the rootGroup
bg.addChild( tTrans );
Then, you can move the object by setting a new translation vector.
Since each object has its own translation group, they can be targeted independently.
When
I create my objects, I do so with a class that wraps them in separate
groups for scaling, rotation, and translation. Then I can control those
independently for each object.
I hope that helps.
Cheers,
Bruce
Posted by: wil Mar 20 2007, 10:46 PM
Thanks so much for your reply Bruce. Ill give it a go.
regards,
wil