I would like to request some new script commands that deal with angles. Namely clamping them. My use case is clamping rotations between a certain angle. Creating a sqf function is possible and I have done it, but repeatedly call that function every frame is not fun.
// Name, Description, return type, unary arg
"clampAngle", "clamp angles a,b,c", SCALAR, ARRAY
"clampAxis", "clamp an axis between 0..360", SCALAR, SCALAR;
"normalizeAxis", "normalize an axis between -180..180", SCALAR, SCALAR;
"clampVector", "clamps all components of a vec3 between 0 and 360", ARRAY, ARRAY
clampAngle [35, 20, 25]; //args are angle value, min angle, max angle returns 25 clampAngle [-20, 20, 25]; // returns 20 clampAxis 400; //returns 40 clampAxis -10; //returns 350 normalizeAxis 562; //returns -158 normalizeAxis -280; // returns 80 clampVector [400, 600, 800]; // returns [40, 240, 80] clampVector[762, 562, 9772]; // returns [42, 202, 52]
In addition information I have provide c++ code for implementation of all the commands that I have requested.