闪存10正投影 [英] flash 10 orthographic projection
问题描述
我已经打了一下用新的Flash 10的3D可能性,并且发现了旋转3D精灵是相当容易的:
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.
现在我想用一个正射投影,和我不知道从哪里开始。的DisplayObject确实有一个的PerspectiveProjection成员,但只能使课程透视投影。也许我应该使用transform.matrix3D?
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.
更新:作为评价之一表明:所述perspectiveProjection.fieldOfView设置为一些接近0(10实际上产生一个更好的结果在我的设置比类似0.1)你得到的投影即几乎正交,这可能是好的够了。
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.
推荐答案
我终于得到它的工作。
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 )
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)
这篇关于闪存10正投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!