flash 10 正交投影
我一直在尝试新的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我终于让它工作了。
现在,添加到应用了此变换的精灵的任何元素都将显示在等角投影中。 (35.264 是一个近似值,请参阅 http://en.wikipedia.org/wiki/Isometric_projection)
I finally got it working.
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)
您可以将 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