因此,由于3D层得到了介绍,AS3支持以下功能:AS3:本地2D到全球3D?
local3DtoGlobal(point3D:Vector3D):Point
和
globalToLocal3D(point:Point):Vector3D
第一个转化3D变换层对全球2D内的点第二个返回投影到3D平面上的2D舞台位置的局部坐标(Vector3D的z坐标将为0)。
什么,但是我需要的是像
local2DToGlobal3D(point:Point):Vector3D
这需要二维局部坐标(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
}
如何做到这一点?希望问题清楚。谢谢!