away3d / away3d-core-fp11

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

Strange behavior when calling unrelated transform within a camera event #713

Open rdoi opened 9 years ago

rdoi commented 9 years ago

Just a transcript of an old bug I've reported on Away3D forum a couple of months ago: http://away3d.com/forum/viewthread/5422/

Basically, you can’t access a sceneTransform and set an unrelated object.transform within an camera event.

  private function initCameraListener() : void {
   view.camera.addEventListener(Object3DEvent.SCENETRANSFORM_CHANGED, onCameraChange);
  }

  private function onCameraChange(event : Object3DEvent) : void {
   const camera : Camera3D = (event.target as Camera3D);
   const obj : Object3D = new Object3D();

   // ********************************************************
   // Does nothing, purposely. Just to force a getter call.
   camera.sceneTransform;

   // This affects the camera hover!
   // Comment out this line, or the above one to get the expected result
   obj.transform = new Matrix3D();
   // ********************************************************
  }

I speculate that it is caused by parallel access of statics consts like Matrix3DUtils.RAW_DATA_CONTAINER and others.

Test project here: http://away3d.com/?ACT=26&fid=47&aid=1831_NeipTW1iRuCzsTtVM5rM&board_id=1