开发者

AS3: Simulating RotationX with Matrix

I have to use Flash CS3, so I can't use the properties rotationX, roationY and rotationZ.

I have a movieclip, that looks like this. It is now flat, no 3D rotation or shearing

AS3: Simulating RotationX with Matrix

But what I want is that this movieclip has a rotationX, or that it is a bit in perspective like this:

AS3: Simulating RotationX with Matrix

As I said, I can't use rotationX, so I have been playing around with Matrix. But I can not get it right.

Here is how I try to do it

myMC.transform.matrix = new Matrix(1,0.15,0.35, 1, 0, 0);

And this is the result

AS3: Simulating RotationX with Matrix

Can you help开发者_如何学JAVA me to get the matrix right, or is there another way?

Thank you, Vincent


Make your life easier and just download a 3D engine for flash 9:

http://away3d.com/downloads

Either that or you can modify your CS3 installation to produce SWF files that target flash 10+


Sorry, rotationX and rotationY are not affine transforms (they obviously do not preserve parallelism between lines), so they cannot be represented by matrix multiplication in 2D space. It is, however, affine in 3D space (where the non-preservation of parallel lines is an apparent effect of the 2D projection, not of the rotation)


i believe what you are trying to do is to get a correct affine transformation matrix.

AS3: Simulating RotationX with Matrix

FYR (Transformation Matrix) http://en.wikipedia.org/wiki/Transformation_matrix

Edits

For more information about 3D transforms and their matrices, Here, see if this applies.

http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/2d_3d_xforms/

Edits 2

A blog post about 3D transform in CS3 and CS4.

3d Rotation the easy way: Buy Flash CS4 uggh! I’m still using CS3 and only for my Flash software. My illustrator, photoshop, premiere, and aftereffects are still at the lowly level of CS2 and for economic reasons, I’m stuck w/ my outdated software configuration for awhile. But if you’re not in my boat or on the same sea as my boat, consider buying the latest, greatest CS4 Flash to make 3D manipulation inherent in flash display objects. Yep, inherent, built in, easy.

In Flash CS3 and below, a display object (i.e. sprite or movieclip) only recognizes one rotation property (rotation: Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation, which is usually the upper left, corner or 0,0). This property only rotates objects in the 2D flat space of the Flash stage. To make 3D work in this flash, one must “fake” it with math. Lots of math, Points, lines, fills, trig, arrays, and sometimes Matrices. Yippee kayae!

In Flash CS4 and above (as of writing there is no above), a display object (i.e. sprite or movieclip) recognizes four (4) rotation properties. Holy Cow! Yeah, four rotation properties:

rotation: Same as in CS3. 2D rotation. rotationX: spin that shit around the X axis of the stage, i.e. vertical flipping. rotationY: spin it around the Y axis of the stage, i.e. horizontal flipping. rotationZ: spin, baby spin o’er the Z axis of the stage. As far as I’m concerned, a spin around the Z axis is the same as rotation (unless, for some reason, the Z axis does not cross through the orientation point of the object). [http://actionscription.wordpress.com/2009/03/12/3d-rotation/]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜