VECTOR forceVec; // our vector we will set depending on joy_force and use for rotation - global definition or local but not in a loop!
var forceThreshold = 0.1; // our threshold value, adjust this if needed
...
// in the function:
vec_set(forceVec, nullvector); // reset our forceVec
if(abs(joy_force.x) > forceThreshold)
{
forceVec.x = sign(joy_force.x);
}
if(abs(joy_force.y) > forceThreshold)
{
forceVec.y = sign(joy_force.y);
}
if(vec_length(joy_force) > 0) // any change?
{
vec_to_angle(my.pan, forceVec);
my.pan -= 90; // remove this line if no offset needed
}