-
21-08-2019 - |
题
我已经打了一下,用新的Flash 10种的3D可能性,并发现,在旋转3D精灵是相当容易:
var card:Sprite = new MyCard()
card.x = 100
card.y = 100
card.z = 200
card.rotationX = -60
addChild(card)
简单有效的,这显示了具有立体旋转的卡。
现在我想使用正投影,我不知道从哪里开始。的DisplayObject确实有一个的PerspectiveProjection成员,但只能做当然透视投影。也许我应该用transform.matrix3D?
我想这应该不是太难,但我看不出如何解决这个问题。
更新:作为评论的一个建议:将perspectiveProjection.fieldOfView设置一些接近0(10实际上产生在我的设置不是像0.1一个更好的结果),你得到的投影就是近正交,这可能是好的够了。
解决方案
我终于得到了它的工作。
var m:Matrix3D = new Matrix3D()
var v3:Vector.<Vector3D> = new Vector.<Vector3D>(3);
v3 = m.decompose();
v3[2] = new Vector3D(1,1,0);
m.recompose(v3)
transform.matrix3D.appendRotation( -90, Vector3D.X_AXIS );
transform.matrix3D.appendRotation( -45, Vector3D.Y_AXIS );
transform.matrix3D.appendRotation( 35.264, Vector3D.X_AXIS );
transform.matrix3D.append(m)
现在任何元素添加到具有此变换施加到其将在等轴测投影示出了子画面。 (即35.264数量为近似值看到 http://en.wikipedia.org/wiki/Isometric_projection)
其他提示
您可以的PerspectiveProjection的fieldOfView域属性设置为接近于0。 我不能确定这是否是最好的方式。
参考: http://thebackbutton.com/misc/f10api/flash /geom/PerspectiveProjection.html
不隶属于 StackOverflow