Here's something I've been struggling with for some time. I've got a function that, when passed 5 args (x, y, z, pan, tilt) it smoothly moves the camera to that position. X, Y, Z and Tilt were easy, assuming you're never looking upside down. I did those by dividing the remaining distance to the goal by the original distance to the goal, multiplying by 180, and using the sin as a velocity factor in each cycle.
The hard part is doing something like this with the pan. The difficulty arises from the fact that 359 and 1 are actually closer than they would mathematically seem... I need it to detect which direction (left vs right) it should be turning based on how "far away" the final pan is from the current pan.
Any ideas would be GREATLY appreciated!