yesOr Is is because I'm doing somthing wrong?
yesDo I need to have some kind of fail safe for that eventuality
and how would you suggest doing it?
Code: Select all
... bodyTilt = math.asin(bodyLRHeight/25) ... BRA = math.asin((BR_height-bodyLRHeight)/47) FRA = math.asin((FR_height-bodyLRHeight)/47) BLA = math.asin((BL_height+bodyLRHeight)/47) FLA = math.asin((FL_height+bodyLRHeight)/47) ...
Now because sine is a ratio between two numbers, its inverse is only valid where that ratio exists (has a defined value). This happens to be between -1 and 1. If you pass in a value outside that range, you get back a special value which represents a non-number, aka NaN. So, clamp any argument v to math.asin such that -1 <= v <= 1.
edit: goddamn ninjas