[Away3D] Strange camera transformations effect


#1

Hello. I’m 3D newbie so it may be silly problem. But anyway… I want to implement free-style interactive camera, moved and rotated by mouse, like in popular 3D editors. It seemed to be easy using Object3D methods like moveForward, rotate and so. However I noticed that rotations make followed movement increased by orders of magnitude. I presumed that Object3D is defigned to cast local to global transforms in easy way, I mean, for example, rotation aroud far pivot were update object position as well. This is probably not true.

For example:
trace("Setup", view.camera.position);
view.camera.moveForward(10);
trace("Moved", view.camera.position);
var v = new openfl.geom.Vector3D(0, 0, -500);
view.camera.pivotPoint = v;
view.camera.rotate(openfl.geom.Vector3D.Y_AXIS, 10);
trace("Roted", view.camera.position);
view.camera.moveForward(10);
trace("Moved", view.camera.position);

Here is an output:
Setup,Vector3D(0, 0, -1000)
hscript:0: Moved,Vector3D(0, 0, -990)
hscript:0: Roted,Vector3D(86.8240888334652, 0, -997.596123493896)
hscript:0: Update,Vector3D(86.8240888334652, 0, -997.596123493896)
hscript:0: Moved,Vector3D(175.3846594436, 0, -995.34416945767)

Distance between position vectors before and after second moveForward is far bigger than 10… Discrepancy grows with rotation angle. Is it bug, misunderstanding or have I just implement position change compensation by hand?


#2

Have you tried doing this using the AS3 version of Away3D?


#3

Certainly not. I’m using only Haxe and have no plans to use other languages. Or maybe should I have?


#4

There was a fix recently for Away3D, I wonder if this is related:

Then another fix:

Seems like this could affect the camera?


#5

I have all haxe libs installed with haxelib. I can use git, but don’t know how to use it with haxelib. Or should I just copy Away3D sources directly into my project directory?

Edit: Never mind, just found how to do it.

Edit2:
I made sure I’m using proper version:
$ >> haxelib git openfl https://github.com/openfl/openfl develop
You already have openfl version git installed.
Overwrite branch: <unspecified> with "develop" [y/n/a] ? y
Installing openfl from https://github.com/openfl/openfl branch: develop
Library openfl current version is now git
Sadly, result is the same.