I'm working on a snake that uses both the moveto and the sine behaviors. I want to tell the snake's head which angle to face based on the "moving angle" of the moveto behavior, which will be limited to 0,90,180,270.
Problem is, the moveto's "moving angle" expression is just the angle between the object's current and previous position, and the sine behavior screws it up. Instead of, say, 180, I get values between 160 and 170. I tried to make the snake face an angle if the moving angle was between these values, but that didn't work for some reason. I'm assuming this is because the variation of the sine is so great that my conditions overlap...or something.
So I'm wondering if there's some math I can use to remove the sine offset from the moveto's "moving angle" entirely. I think I need to calculate the difference of the angle w/ sine and the desired angle, then subtract it, but I dunno how to get the desired angle in the first place. Agh.
EDIT: Kinda solved this by rounding a separate move angle var to the nearest max deviation of the sine, then comparing that variable instead. So if the moveto's moving angle is within, say, 15 of 180, my var will be 180 and the snake will face it properly. Would still be nice to have the proper expression if anyone's got some free time though