因此,由於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
}
如何做到這一點?希望問題清楚。謝謝!