Okay, so I still haven't figured out what's broken. Can someone figure out what I'm doing wrong here? Here's the code as it currently stands (including commented out remnants):
function vwaveImage::onFire(%this,%obj,%slot)
{
%obj.playThread(2, shiftLeft);
//%obj.toolAmmo[%obj.currTool]--;
//%obj.AmmoSpent[%obj.currTool]++;
commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>Wave Shot<font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["Vwaveshots"] @ "", 4, 2, 3, 4);
%spread = 0.01;
%vector = %obj.getMuzzleVector(%slot);
echo("vector is " @ %vector);
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
echo("vector1 is " @ %vector1);
%objectVelocity = %obj.getVelocity();
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
echo("vector2 is " @ %vector2);
%a = (-0.5) * 10 * 3.1415926 * %spread;
%b = (0.5) * 10 * 3.1415926 * %spread;
%c = (0) * 10 * 3.1415926 * %spread;
//%mat1 = MatrixCreateFromEuler(%a @ " " @ %a @ " " @ %a);
//%mat2 = MatrixCreateFromEuler(%b @ " " @ %b @ " " @ %b);
//%mat3 = MatrixCreateFromEuler(%a @ " " @ %b @ " " @ %a);
//%mat4 = MatrixCreateFromEuler(%b @ " " @ %a @ " " @ %b);
//%mat1 = MatrixCreateFromEuler("1 0 0");
//%mat2 = MatrixCreateFromEuler("-1 0 0");
//%mat3 = MatrixCreateFromEuler("0 1 0");
//%mat4 = MatrixCreateFromEuler("0 -1 0");
%mat1 = "0 0 0 1 0 0 .2";
%mat2 = "0 0 0 -1 0 0 .2";
%mat3 = "0 0 0 0 0 1 .2";
%mat4 = "0 0 0 0 0 -1 .2";
echo("Mat1 is " @ %mat1);
echo("Mat2 is " @ %mat2);
echo("Mat3 is " @ %mat3);
echo("Mat4 is " @ %mat4);
//%velocity = VectorAdd(%vector1,%vector2);
//VectorAdd
//MatrixMulVector
%vecrot0 = %vector1;
echo("Vecrot0 is " @ %vecrot0);
%vecrot1 = MatrixMulVector(%mat1, %vector1);
echo("Vecrot1 is " @ %vecrot1);
%vecrot2 = MatrixMulVector(%mat2, %vector1);
echo("Vecrot2 is " @ %vecrot2);
%vecrot3 = MatrixMulVector(%mat3, %vector1);
echo("Vecrot3 is " @ %vecrot3);
%vecrot4 = MatrixMulVector(%mat4, %vector1);
echo("Vecrot4 is " @ %vecrot4);
%velocity0 = VectorAdd(%vecrot0,%vector2);
//echo("Velocity0 is " @ %velocity0);
%velocity1 = VectorAdd(%vecrot1,%vector2);
//echo("Velocity1 is " @ %velocity1);
%velocity2 = VectorAdd(%vecrot2,%vector2);
//echo("Velocity2 is " @ %velocity2);
%velocity3 = VectorAdd(%vecrot3,%vector2);
//echo("Velocity3 is " @ %velocity3);
%velocity4 = VectorAdd(%vecrot4,%vector2);
//echo("Velocity4 is " @ %velocity4);
//echo("Velocity is " @ %velocity);
//main
//%velocityfinish0 = %velocity;
//up
//%velocityfinish1 = MatrixMulVector(%mat1, %velocity);
//down
//%velocityfinish2 = MatrixMulVector(%mat2, %velocity);
//left
//%velocityfinish3 = MatrixMulVector(%mat3, %velocity);
//right
//%velocityfinish4 = MatrixMulVector(%mat4, %velocity);
//%vec1 = %player.getMuzzleVector(%slot);
//%vec0 = %velocity;
//%vec1 = vectorRotateEuler(%vec0, "0 0 10");
//echo("Vec1 is " @ %vec1);
//%vec2 = vectorRotateEuler(%vec0, "0 0 -10");
//%vec3 = vectorRotateEuler(%vec0, "10 0 0");
//%vec4 = vectorRotateEuler(%vec0, "-10 0 0");
for(%shell=0; %shell<5; %shell++)
{
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity[%shell];
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}
My best guess is that I'm misusing matrixmulvector, but I don't know what I'm doing wrong specifically or how to fix it.