【问题标题】:flash 10 orthographic projectionflash 10 正交投影
【发布时间】:2010-10-14 12:27:18
【问题描述】:

我一直在玩一些新的 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?

我认为这应该不会太难,但我不知道如何解决这个问题。

更新:正如其中一位 cmets 所建议的那样:将 perspectiveProjection.fieldOfView 设置为接近 0 的值(10 实际上在我的设置中产生比 0.1 更好的结果)你会得到一个几乎正交的投影,这可能很好够了。

【问题讨论】:

    标签: flash actionscript-3 projection orthographic


    【解决方案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

    【讨论】:

      【解决方案2】:

      您可以将 PerspectiveProjection 的 fieldOfView 属性设置为 NEAR 0。 我不确定这是否是最好的方法。

      参考:http://thebackbutton.com/misc/f10api/flash/geom/PerspectiveProjection.html

      【讨论】:

      • 是的,谢谢,我刚刚发现并准备更新我的问题。
      猜你喜欢
      • 2013-01-22
      • 2015-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-06
      • 2013-11-26
      • 1970-01-01
      相关资源
      最近更新 更多