因此,由于引入了3D图层,AS3支持以下功能:
local3DtoGlobal(point3D:Vector3D):Point
和
globalToLocal3D(point:Point):Vector3D
第一个将3D变换层内部的点变换为全局2D阶段坐标,第二个返回投影到3D平面上的2D阶段位置的局部坐标(Vector3D的z坐标将为0)。
我需要的是
local2DToGlobal3D(point:Point):Vector3D
获取2D局部坐标(在3D变换图层中)并返回表示全局3D空间中位置的Vector3D。
示例:
//_foo3D:MovieClip is a MovieClip with a 3D rotation applied to it, child of the stage
//_bar:MovieClip is some test MovieClip, child of the stage
function asdf(){
var p:Point = new Point(50,50);
_foo3D.graphics.beginFill(0,1);
_foo3D.graphics.drawCircle(p.x, p.y, 50);
_foo3D.graphics.endFill();
var p3D:Vector3D = _foo3D.FUNCTIONINEED(p);
_bar.x = p3D.x;
_bar.y = p3D.y;
_bar.z = p3D.z;
//the movieClip _bar should now optically lie over the circle drawn within _foo3D
}
怎么做?希望问题很清楚。谢谢!