# Using Scripted Controllers With Trig Functions.. Hit A Snag

I am having some trouble getting some components on a mechanical device to move properly. I have broken the movements I need down, and think I am on my way to a solution. However, there is an issue I have run up against:

http://www.versatileartist.com/temp/PCA_anim06.max

The problem in question can be found by selecting the yellow line (Radius_Pitch01xy), going to Motion -> Assign Controller, and choosing "X Rotation: Float Script".

I am trying to get the yellow line to rotate such that it will form the third side of the triangle (i.e. matching the rotation of the brown line.) The brown line uses a lookat controller, which is not a workable solution for what I am trying to do.

The math for this should be fairly simple.. the sine of an angle (the angle in radians) is a/c, with a and c being the opposite and hypotenuse sides of the triangle (I already have the lengths, so it should work just as I have it.. however, if you move the time slider around you will see that, while it starts out kinda close, it isn't lining up, and becomes worse when the dimensions of the triangle change.