Notes for learning Flex 4. The goal is to use Away3D as the container for Flex 4 components, so that the 3D elements can affect Flex 4 components (e.g., rotating a cube with Flex 4 version of VideoPlayer on each side).


Phase 5


Animate during the transition
I want the animation to make more sense visually. Part of the problem is that the horse runs in place. I want it to stop when it reaches the correct area, and start when it’s supposed to go somewhere. I know that Flex 4 has a new set of Tween classes, but I am used to Tweener. At this point, I will set up a Tweener transition, then later see how easy it will be in Flex4. (Note that at this point, I am using Flex3 context. Cheating, I know. I have seen that Flex4 has some more high-level tweening added, but with Tweener there is the advantage that it can be ported to Javascript and other languages.)

Face the MD2 model toward some point.
This is a bit more difficult. The model is currently pointing at a 45 degree angle along the x-axis. This is in Away3D space, and not in Flex; the rotation of the Flex component is unchanged at the moment. One solution is to rotate the Flex component toward the goal, but this has a problem if the MD2 is more than just a single MD2. Besides, it would be nice to have a generic method to point the MD2 at a point on the 2D Flash screen.

2010-06-16

So, I am currently reading this webpage: http://www.fastgraph.com/makegames/3drotation/
Boy, that is difficult. Reading this one now: http://www.gamedev.net/reference/articles/article1199.asp
Ugh. Ok, need more math. Will sign up for a matrix algebra course this fall. Posted a note to try and find a quick-and-easy solution to the problem: http://groups.google.com/group/away3d-dev/browse_thread/thread/2b29aa7c51210922

2010-06-17

Ok, so it’s clear that I was on the wrong track with my rotation. I do have to use obj.rotateX for overall positioning, but spinning the object has to take place using local rotations: yaw, pitch, and roll:

public function turnToward(deg:Number):void
{
    testHorse.yaw(deg);
    this.view.render();
}

This works to spin the MD2 on it’s axis, and still maintain the viewing angle, animation motion, etc. So now I need the correct angle between the MD2’s current location (as a Flex component) and where it is trying to go

{Post is incomplete. Update is pending.}

– 30 –

Advertisements