(e:Event) --> LoaderEvent
and dd is placed at random x and z,
so the child tar adds the offset of dd position when you ask
scenePosition
if you ask position, it will return its position in the container
Fabrice
On May 14, 2009, at 3:46 PM, ben wrote:
Eh non !!!
I get the same coord as the container , the code (again):
private function loadModelComplete(e:Event) {
var dd:ObjectContainer3D=new ObjectContainer3D();
dd.name="rock";
dd.addChild(e.target.handle);
dd.x=Math.random()*200;
dd.z=Math.random()*200;
scene.addChild(dd);
trace(dd.position);
var tar:Mesh = e.target.handle.children[1] as Mesh;
trace(tar.scenePosition);
if(e.target.handle.children[0].name == "phono"){
var phono:Mesh = e.target.handle.children[0] as Mesh;
phono.bothsides = true;
for(i=0;i<phono.faces.length-1;i++)
{
var fc:Face = phono.faces[i] as Face;
fc.material=colorMaterialTab[Math.floor(Math.random()
*colorMaterialTab.length)];
}
}
dd.useHandCursor=true;
dd.pitch(-90);
phono.addOnMouseDown(onMouseClickOnObject);
}
trace :
x:64.0165800228715 y:0 z:25.430947449058294
x:64.0165800228715 y:0 z:25.430947449058294
but thos object is not at 0,0,0 in the scen imported ?????
Help!