robertnyc
November 25th, 2008, 02:20 PM
I've been having some trouble understanding displayObject.local3DToGlobal() --
I want to determine the global (stage) x/y coordinates of a display object that's existing in Flash 3D space -- i.e. has a Z. I thought what I'd do is this (in pseudocode):
class myDisplayObject {
v3:Vector3D = new Vector3D(this.x, this.y, this.z);
pt:Point = this.local3DToGlobal(v3);
}
but apparently what I need to do is
class myDisplayObject {
v3:Vector3D = new Vector3D(this.x, this.y, this.z);
pt:Point = parent.local3DToGlobal(v3);
}
That is, the local3DToGlobal call must be called by the parent of the object. Is this true? Why? What am I not grokking here? If I do it from the object itself, it gives me wrong coordinates...
and this is also true if I do it outside a class structure as in
v3 = new Vector3D(myDisplayObject.x,myDisplayObject.y,myDis playObject.z);
pt = myDisplayObject.local3DToGlobal(v3);
as opposed to
v3 = new Vector3D(myDisplayObject.x,myDisplayObject.y,myDis playObject.z);
pt = this.local3DToGlobal(v3;)
Thanks for any info -- I can't find this documented anywhere in the Adobe docs/examples…
I want to determine the global (stage) x/y coordinates of a display object that's existing in Flash 3D space -- i.e. has a Z. I thought what I'd do is this (in pseudocode):
class myDisplayObject {
v3:Vector3D = new Vector3D(this.x, this.y, this.z);
pt:Point = this.local3DToGlobal(v3);
}
but apparently what I need to do is
class myDisplayObject {
v3:Vector3D = new Vector3D(this.x, this.y, this.z);
pt:Point = parent.local3DToGlobal(v3);
}
That is, the local3DToGlobal call must be called by the parent of the object. Is this true? Why? What am I not grokking here? If I do it from the object itself, it gives me wrong coordinates...
and this is also true if I do it outside a class structure as in
v3 = new Vector3D(myDisplayObject.x,myDisplayObject.y,myDis playObject.z);
pt = myDisplayObject.local3DToGlobal(v3);
as opposed to
v3 = new Vector3D(myDisplayObject.x,myDisplayObject.y,myDis playObject.z);
pt = this.local3DToGlobal(v3;)
Thanks for any info -- I can't find this documented anywhere in the Adobe docs/examples…