更改3D注册点以在AS3中旋转

| 有人有我可以用来更改DisplayObjects在3D空间中旋转的中心点的代码吗?我需要它与rotationX,rotationY和rotationZ一起使用。我知道有一种解决方法,可以将每个对象包装在另一个精灵中,并偏移x和y位置,但是我更喜欢数学解决方案。 作为问题的示例,此代码应为星形:
var a=new Sprite()
addChild(a)
a.graphics.lineStyle(0,0xFF0000)
a.graphics.moveTo(10,10)
a.graphics.drawRect(100,100,100,100)

var b=new Sprite()
addChild(b)
b.graphics.lineStyle(0,0)
b.graphics.moveTo(10,10)
b.graphics.drawRect(100,100,100,100)
b.rotationZ=45
... 更新:感谢Alex的提示,我在这里发布了可重用的解决方案:)     
已邀请:
您需要使用Matrix3D对象,并将其应用于DisplayObject实例的transform属性。您必须先定义DisplayObject的z属性,然后才能应用4x4 3DMatrix转换。 所以像这样:
myObject.z = 1; 
    myObject.transform.matrix3D.appendTranslation(10,10,0);
    myObject.transform.matrix3D.appendRotation(1, Vector3D.Y_AXIS);
    myObject.transform.matrix3D.appendTranslation(-10,-10,0);
来自:http://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/geom/Matrix3D.html 希望能帮助到你 :)     

要回复问题请先登录注册