Sounds very similar to what i did:
%pi = 4 * mAtan(1, 1);
%rotN = vectorNormalize(%rot);
%velN = vectorNormalize(%vel);
%rotX = getWord(%rotN, 0);
%rotY = getWord(%rotN, 1);
%velX = getWord(%velN, 0);
%velY = getWord(%velN, 1);
%atan1 = mAtan(%velY, %velX);
%atan2 = mAtan(%rotY, %rotX);
%angle = %atan2 - %atan1;
if (%angle > %pi)
%angle -= 2 * %pi;
else if (%angle < -%pi)
%angle += 2 * %pi;
%angle = mRadToDeg(%angle);
//echo("Velocity:" SPC %vel SPC "| Rotation:" SPC %rot SPC "| angle:" SPC %angle);
if (%angle < -5 && %angle > -100)
{
echo("Step Left");
%velocity = %player.getMaxSideSpeed() * 2;
%player.doDodge(vectorNormalize(%player.getLeftVector()), %velocity, %isOnGround, %data.canTeleDodge);
}
else if (%angle > 5 && %angle < 100)
{
echo("Step Right");
%velocity = %player.getMaxSideSpeed() * 2;
%player.doDodge(vectorNormalize(%player.getRightVector()), %velocity, %isOnGround, %data.canTeleDodge);
}
else if (%angle >= 100 || %angle <= -100)
{
echo("Step Back");
%velocity = %player.getMaxBackwardSpeed() * 2;
%player.doDodge(vectorNormalize(vectorScale(%player.getForwardVector(), -1)), %velocity, %isOnGround, %data.canTeleDodge);
}
Though i am pretty sure the calculations can be done more efficiently.
It just took a whole while for me to understand it and get it right.