accessing sceneTransform breaks posterior transformations

Software: Away3D 4.x

R Villani, Newbie
Posted: 03 February 2012 09:30 AM   Total Posts: 13

I’ve posted this bug on Git but after about 5 hours trying, I was able to solve. Here is what I put on Git Issues:

Problem
All objects related to an object which has the sceneTransform property accessed inside an Object3DEvent.SCENETRANSFORM_CHANGED listener function loose their visual transformation and you see them rendered as it had no transform at all.

Obs.: using Dev branch.

Sample code to reproduce bug:

addEventListener(Event.ENTER_FRAMEonFrame);
objCont3D.addEventListener(Object3DEvent.SCENETRANSFORM_CHANGEDonTransformChanged);

private function 
onFrame(event:Event):void {
objCont3D
.rotationY += 2;
}

private function onTransformChanged(event:Object3DEvent):void {
objCont3D
.sceneTransform// just trying to access the property triggers the bug already

Solution
The problem was the _sceneTransformDirty property in ObjectContainer3D never being set true again after a read of the property sceneTransform since I was using rotationY to transform the object. And unlike the overrided functions, like rotate, rotationY was not triggering the notifySceneTransformChange, because it was being called directly from the Object3D class.

So what I did was to override all ‘set’ methods from the Object3D class that affect the object transform making them trigger the notifySceneTransformChange.
That solved it!

As soon as I get to know that this problem is solved on the source files, I change the title to “[SOLVED] - ...”.

I’ve also attached the edited ObjectContainer3D class in case someone bumps on this problem too.
I’ve corrected the names of the MouseEvent3D on the Event tags, too. They were missing the “3d” at the end.

 

File Attachments
ObjectContainer3D.zip  (File Size: 4KB - Downloads: 183)
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X