Gag. I figured it out. The line
camera.tilt = -atan(temp);
should have been
camera.tilt = atan(temp)-90;
Or I could have just used vec_to_angle... it does all the math and work for you... and it's probably faster... sheesh. What's the moral of this story kids? READ THE MANUAL. Before you do any tricky script tricks see if there's a command for what you're trying to do.
Thanks anyways guys.