I have a little proc that rotates vectors for me:
CODE
global proc float[] rotateVector(float $vx, float $vy, float $vz, float $rx, float $ry, float $rz)
{
float $temp, $sx, $cx, $sy, $cy, $sz, $cz;
$rx = deg_to_rad($rx);
$ry = deg_to_rad($ry);
$rz = deg_to_rad($rz);
$sx = sin($rx);
$cx = cos($rx);
$sy = sin($ry);
$cy = cos($ry);
$sz = sin($rz);
$cz = cos($rz);
$temp = $vy * $cx - $vz * $sx;
$vz = $vy * $sx + $vz * $cx;
$vy = $temp;
$temp = $vz * $sy + $vx * $cy;
$vz = $vz * $cy - $vx * $sy;
$vx = $temp;
$temp = $vx * $cz - $vy * $sz;
$vy = $vx * $sz + $vy * $cz;
$vx = $temp;
float $resV[] = {$vx, $vy, $vz};
normalize($resV);
return $resV;
}
I use it quite often. You tell it the vector you have and then the rotation you want to perform and it returns you a floatArray with the rotated vector:CODE
float $rotVector[] = rotateVector 0 0 1 $shotRot[0] $shotRot[1] $shotRot[2]
;
I don't know if this helps.. but thats my idea.
Actually I don't have a clue how it really works. I just got such a function in C++ from a friend and translated it into mel ;]