| **Using Sine/Cosine in Parameter Wiring**
by Thomas MaCoy on Mar 2, 2012 at 3:51:29 am |

Can't seem to find any straight forward references so I'll give a shot here: Basically, is there a trick to using trig functions in a parameter wiring expression?

I'm setting up a model with various moving bits, most of which rotate around one axis; my usual approach is to setup a dummy control object and wire all the moving bits back to it with the appropriate multiplier or divider. In this case though, I've got one long box that I want to rotate back and forth: 0 degrees, to 30 degrees, to -30 degrees, and back to 0, while the other objects rotate through a full 360. For simplicity's sake I'd like to wire it back to the same dummy control object (rather than going into the curve editor and setting up a separate ping pong curve) and figured (reaching back to high school trig) a sine function would work. However, when I put in, say sin(X_rotation) for Box's Y Rotation (or x or z) there's no sign of any back and forth movement no matter how far I rotate the dummy object; it just keeps rotating slowly in the same direction, as though I'd entered something like X_rotation/10 in the control expression. From the math I remember (and what my calculator says), it should rotate 1 degree when the dummy hits 90, back to 0 when the dummy hits 180, to -1 when dummy reaches 270, and 0 again when the dummy reaches 360. (And from there I can add a multiplier of *10 or *30 or whatever I need to get the amount of rotation I'm looking for).

So that rambled a bit, but I'm hoping there's just an odd detail I'm missing in how the expression's entered that'll get the behavior I'm going for. Any helps appreciated, thanks.

| **Re: Using Sine/Cosine in Parameter Wiring** by Thomas MaCoy on Mar 3, 2012 at 4:31:37 am |

And solved, for anyone that comes across it. It's a quick in the way Max (at least as of 9) treats degrees and radians; changing the expression at follows degtoRad(sin(radtoDeg Y_Rotation)), converting the dummy rotation to Degrees and then back to Radians after taking the Sin does the trick.