Hey DrMcCleod it sounds like you are having problems because you are not setting the 'right' vector - the third in up,forward,right, to complete the transformation. setting only two will cause a shearing transform - to keep things as a strict orthogonal transformation you need to set the right vector perpendicular to the other two.
Rob On Fri, Oct 2, 2009 at 4:23 PM, DrMcCleod <[email protected]> wrote: > > I should probably mention that the up and forward vectors are in the > global reference frame. > > On Oct 2, 3:57 pm, DrMcCleod <[email protected]> wrote: > > I have a camera3D object and other geometry inside an > > ObjectContainer3D, in order that I can move the ObjectContainer and > > keep all the objects locked together. I have set the ObjectContainer3D > > pivot to be at the location of the camera. > > I would like to apply an up vector and forward vector to the > > ObjectContainer3D so that the view direction of the camera inside it > > changes, but the following code causes the ObjectContainer3D to > > distort, rather than rotate to the unit vectors described by upX, upY, > > upZ and frontX, frontY, frontZ. > > Where am I going wrong? > > > > private function enterFrameListener(e:Event):void > > { > > var myNewMatrix:MatrixAway3D; > > > > myMatrix = new MatrixAway3D(); //make a new instance of the > > Away3D matrix > > > > myMatrix.clone(myObjectContainer.transform); //copy all the > > matrix contents of the container > > > > myMatrix.up = new Number3D( upX, upY, upZ); //set the up vector in > > the matrix > > > > myMatrix.forward = new Number3D(forX, forY, forZ); //set the > > forward vector in the matrix > > > > myObjectContainer.transform(myMatrix); //apply this new matrix to > > the container > > > > view.render(); > > > > } > -- Rob Bateman Flash Development & Consultancy [email protected] www.infiniteturtles.co.uk www.away3d.com
