add child in the same screen place

Software: Away3D 4.x

kyrpyr, Newbie
Posted: 17 May 2012 05:02 PM   Total Posts: 2

Hi!

//make cube
var geometry:Geometry = new CubeGeometry();
var 
cube:Mesh = new Mesh(geometry);
//make container for cube
var container:ObjectContainer3D = new ObjectContainer3D();
container.addChild(cube);
scene.addChild(container);

//random transform & positioning container
container.rotationX Math.random() * 100;
container.rotationY Math.random() * 100;
container.rotationZ Math.random() * 100;
container.Math.random() * 500;
container.Math.random() * 500;
container.Math.random() * 500;

//QUESTION: i need to remove cube from container and add to scene in the same screen place. Anybody know how?
scene.addChild(cube); 
   

John Brookes, Moderator
Posted: 18 May 2012 08:53 PM   Total Posts: 732   [ # 1 ]

cube.transform = cube.sceneTransform.clone()
scene.addChild(cube);

   

kyrpyr, Newbie
Posted: 18 May 2012 09:02 PM   Total Posts: 2   [ # 2 ]

Wow! It works, thank you)

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X