Strange behavior when calling consecutive transform within an event

Software: Away3D 4.x

rdoi, Member
Posted: 10 April 2014 01:58 PM   Total Posts: 86

Basically, you can’t access a sceneTtransform and set an unrelated object.transform within an event…?

private function initCameraListener() : void {

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

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

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

I’ve attached a full code for an example of this strange behaviour.

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

I understand that it optimizes the memory access avoiding constant memory allocation, but it may cause some weird problems when running in asynch codes.



File Attachments  (File Size: 4KB - Downloads: 674)

ranoya, Newbie
Posted: 10 April 2014 02:24 PM   Total Posts: 29   [ # 1 ]

A similar problem was happening to me.

I was trying to link 2 cameras, registering a listener to the first cam to control the secondĀ“s transformation matrix, after a matrix transformation.

I noticed that this problem is avoided when we set the position, rotation and scale attributes individualy, instead of attributing the whole transformation matrix at once.

But I would certainly prefer to set the matrix, as you are trying to do.


Beek, Member
Posted: 15 March 2015 09:18 PM   Total Posts: 67   [ # 2 ]

I think I have a similar issue where doing any maths on a Quaternion that relates to the camera transform, causes the hover Camera to flip and do crazy stuff.

i.e. I set the camera transform with

camera.transform q.toMatrix3D(); 

I can change back to hover camera with no problems.

As soon as I do anything like

_currentPan q.toEulerAngles(Vector3D.Y_AXIS).180/Math.PI

When I switch back to a hover camera, the camera is flipped on a crazy angle.

Is this a bug in the Quaternion code?



Away3D Forum

Member Login