Rotating

20 views
Skip to first unread message

delfeld

unread,
Jun 16, 2010, 5:24:42 PM6/16/10
to Away3D.dev
Hello,

I am trying to figure out rotations in 3D, but am lousy at matrix
math.

I have rotated a 3D object (MD2 file mesh) so that it looks like an
isometric view:

obj.rotationX = 45;

Now I need to rotate this object so that it remains at that angle in
terms of the camera . . . it has to remain looking isometric and
standing on the same virtual plane, but I want to see the other side
of it.

I am providing this rotation in one angle, which would be a rotation
around the "up" axis (which is now 45-degrees offset on the x-axis).

How can I do this?

savagelook

unread,
Jun 17, 2010, 10:20:03 AM6/17/10
to Away3D.dev
rotationX, rotationY, rotationZ all work in the global coordinate
system. You need to use the functions pitch(), yaw(), and roll() to
achieve the same function in the local coordinate space,
respectively. The following code would rotate your object around its
local Y (up) axis:
obj.yaw(angle);

If you are trying to achieve an isometric view, why not use the
OrthogonalLens for your camera?
view.camera.lens = new OrthogonalLens();

delfeld

unread,
Jun 17, 2010, 11:37:08 AM6/17/10
to Away3D.dev
I'll look into p/r/y.

> If you are trying to achieve an isometric view, why not use the OrthogonalLens for your camera?

Mainly because I haven't started addressing any camera issues. Still
doing proof-of-concept tests.

Thank you for the help!

delfeld

unread,
Jun 17, 2010, 12:22:20 PM6/17/10
to Away3D.dev
The yaw works correctly, but it is additive. Is there any way to
determine the current "yaw" rotation, or do I have to store it in a
local variable?

delfeld

unread,
Jun 18, 2010, 1:52:50 PM6/18/10
to Away3D.dev
This may seem like a lazy question, but it seems a bit difficult to
manage maintaining a rotation variable for an arbitrary "up" angle.
When the "up" is only the y-axis, it's simple. But moving another
axis adds complexity. It would be useful to be able to discern what
the current "up" rotation is.
Reply all
Reply to author
Forward
0 new messages