Oh nice, thanks for that! However, still no go. I can save the position but the rotation is just broken. I guess the problem lies with the coordinate system. You are using a positive Z towards the user, is that correct? While Away3D has the positive Z facing away from the user.
Unfortunately I have very few knowledge about these things (shame on me!), but I assume this would completely break the rotation. Is that so? Any hint/advance how to fix it?
Edit:
Here is how I am solving it:
private function saveOrientation():void {
var quatString:String = ExternalInterface.call("getQuaternionString"); //from JS in format "x,y,z,w"
var quatArray:Array = quatString.split(",");
_relX = -quatArray[0];
_relY = -quatArray[1];
_relZ = quatArray[2];
_relW = quatArray[3];
}
And then upon update I use:
var quatString:String = ExternalInterface.call("getQuaternionString"); //from JS in format "x,y,z,w"
var quatArray:Array = quatString.split(",");
var x:Number = -quatArray[0];
var y:Number = -quatArray[1];
var z:Number = quatArray[2];
var w:Number = -quatArray[3]; //there is a minus here, why?
I have absolutely NO idea whether this is correct but it seems to work with a test cube. Is this approach at least remotely correct?
All the rest of the calculation is from the example you showed me I am just not inverting the final transformation matrix (AS3: Matrix3D objects can be initialized with a Vector of 16 Numbers, where every four elements is a column.)