away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
639 stars 274 forks source link

4.1.6 Bug with rotationZ on ObjectContainer3D, it uses global Z axis instead of local Z axis #697

Open lvignals opened 10 years ago

lvignals commented 10 years ago

Hi! I noted that since 4.1.6 (Master or Dev branch) the ObjectContainer3D rotate() function is using the global Z axis (only for Z) instead of the local Z axis. Below is a sample with the breaking code from 4.1.4 Gold (working as expected) to 4.1.6 (Master or Dev, not working as expected)

//For ObjectContainer3D since 4.1.6 and above if (...) rotate(Vector3D.Y_AXIS, -YAW * dt); //causes rotation around local Y if (...) rotate(Vector3D.Y_AXIS, YAW * dt); //causes rotation around local Y if (...) rotate(Vector3D.X_AXIS, PITCH * dt); //causes rotation around local X if (...) rotate(Vector3D.X_AXIS, -PITCH * dt); //causes rotation around local X if (...) rotate(Vector3D.Z_AXIS, ROLL * dt); //causes rotation around GLOBAL Z (Issue) if (...) rotate(Vector3D.Z_AXIS, -ROLL * dt); //causes rotation around GLOBAL Z (Issue)

Thanks and great work on Away3d, great library!

lvignals commented 10 years ago

Using the rotationZ property instead of the rotate() function carries the same issue:

rotationZ += ROLL * dt; //same Issue rotationZ -= ROLL * dt; //same Issue

To reproduce issue: load a model in an ObjectContainer3D. Rotate the model along Y by 90 degrees (model will Yaw as expected) then Rotate along Z and you will find that your model Picth is affected instead of the Roll because rotationZ is using the Global Z Axis instead of the local Z axis which should have been rotated 90 degrees since the ObjectContainer3D was first rotated along Y by 90 degrees.

I hope that helps :-)

SharpEdgeMarshall commented 10 years ago

You are right! I've searched in commits and it's not so easy to found the cause!