flash 10 正交投影

发布于 2024-07-15 07:35:50 字数 481 浏览 12 评论 0原文

我一直在尝试新的 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更好的结果),你会得到一个接近正交的投影,这可能已经足够好了。

I've been playing a bit with the new flash 10 3d possibilities, and found out that rotating a sprite in 3d is fairly easy:

var card:Sprite = new MyCard()
card.x = 100
card.y = 100
card.z = 200
card.rotationX = -60
addChild(card)

Simple and effective, this shows the card rotated with perspective.

Now I want to use an orthographic projection, and I have no clue where to start. DisplayObject does have a perspectiveProjection member, but that can only make perspective projections of course. Maybe I should use the transform.matrix3D?

I'd think this should not be too hard, but I don't see how to tackle this issue.

UPDATE: as one of the comments suggests: setting the perspectiveProjection.fieldOfView to something close to 0 (10 actually produces a nicer result in my setup than something like 0.1) you get a projection that is nearly orthographic, that might be good enough.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

高跟鞋的旋律 2024-07-22 07:35:50

我终于让它工作了。

        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)

I finally got it working.

        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)

Now any element added to the sprite that has this transform applied to it will show up in isometric projection. (that 35.264 number is an approximation see http://en.wikipedia.org/wiki/Isometric_projection)

孤寂小茶 2024-07-22 07:35:50

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

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

You could set the fieldOfView property of PerspectiveProjection to NEAR 0.
I'm unsure if this is the best way.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文