PDA

View Full Version : Matrix3D.prependRotation ignores center?



m90
March 8th, 2009, 01:14 PM
Hello!

I am trying to rotate an Array of Vector3D-Objects around in space. It all works fine except for it will ignore the pivot point of the rotation and will always rotate around (0,0,0).

They way I am doing it is:

function rotate(a:Array, rx:Number, ry:Number, rz:Number, c:Vector3D):void{

var rot:Matrix3D = new Matrix3D();
rot.prependRotation(rx, Vector3D.X_AXIS, c);
rot.prependRotation(ry, Vector3D.Y_AXIS, c);
rot.prependRotation(rz, Vector3D.Z_AXIS, c);

for (var i:uint = 0; i < a.length; i++){
a[i] = rot.deltaTransformVector(a[i]);
}

}c is a valid Vector3D that is not (0,0,0). Yet all transformations are performed around (0,0,0). Anyone got an idea what I am doing wrong?

Thank you!!!