Subscribe to
Posts
Comments

Flash Player 10 Rotation XYZ Fun

I’ve been playing around a lot with Flash Player 10’s rotation XYZ.  After doing a series of experimentation and actually implementing it into a new project, I had some doubts about Adobe’s implementation of 3D.

Experiment #1: http://blog.dcholth.com/beta/RotTester/RotTester.html

The images are laid out in a grid, with each image’s rotations (XY & Z) being set to the values of the numeric sliders at the top.  As you can see, each image’s perspective looks different, because they are placed in a 3D environment with the ‘camera’ being set to a specific point.  I had a heck of a time figuring out how to set that camera!

If you look at http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html#rotationX  it says “Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.”

Well, in the example above, each image is placed in its own Canvas - my best guess was that the parent canvas should be its ‘3D Container’ so the rotation should be based off of that, but clearly it was basing off some other point at the Application level.

I posted my frustrations with this a few places, and finally fellow Universal Minder, Ryan Graff came to the rescue, with the missing piece:  PerspectiveProjection

Setting the PerspectiveProjection of your target’s Transform will give you the results I believe most developers will be looking for.

Experiment 2: http://blog.dcholth.com/files/PanelTest/PanelTest.html

The image in the TitleWindow on the left has its PerspectiveProjection set to be the center of the TitleWindow, where as the image in the TitleWindow on the right has the default properties.  Notice that dragging the TitleWindow on the right around the screen results in distortion of the image, where the image on the left remains tilted exactly how we want.

Experiment 3: http://blog.dcholth.com/files/RotatorTest/RotatorTest.html

Back to our grid of images, here we set the images PerspectiveProjection to point towards the red dot.  Drag it around the screen to see how it effects how each image is percieved.

In conclusion, I believe that most developers will want to take advantage of the PerspectiveProjection’s properties when working  rotations of UIComponents in 3dSpace.

One Response to “Flash Player 10 Rotation XYZ Fun”

  1. […] I am sitting in tonight’s FlashMN meeting and am quite impressed with the stuff Dan Holth is doing with 3D in Flash. He (and his team) are working on a sweet 3D application that allows you to test out all sorts of floor tiling (literally floor tiles that you would lay down on the floor of your kitchen or bathroom) types, patterns, and colors. […]

Leave a Reply