Adjusting camera orientation causes weird jumps in rotation


#1

I am importing a camera animation from a different program which has a different axis orientation. In order to orient it properly I need to subtract 90 degrees from the z axis and add 90 degrees to the x axis using these lines:

newCamera.rotation.z_rotation -= 90
newCamera.rotation.x_rotation += 90

This works great, but causes strange jumps in animation as the images show below. The first image with the clean lines shows the animation without the reorientation commands, and the second image is with those commands. If I were just importing into 3ds max this wouldn’t be a problem, but I’m eventually going to export this same path back to the original program (for testing) and I’ve had trouble with these jumps.


#2

It seems to be something related to gimbal lock. Turns out Euler Filter in the Track View Utilities fixes it, but I need a method to do this via maxscript. I’ll update this thread when I find more information.


#3

Well my search was somewhat fruitful. If you want to clean up the curve editor manually you can use Euler Filter. It is a very quick, easy, and efficient method. Unfortunately I couldn’t find any way to use that particular function via maxscript.

I was, however, able to find something that may explain the underlying math for Euler Filter and how you could make your own function. It is a method of converting the rotation matrix into 2 possible euler angles, which presumably you would choose which one lines up cleanly with the rest of the animation path. I haven’t bothered with that math since I’d rather just use the Euler Filter to avoid the headache, but here’s the link if any of you are interested in trying to implement this yourself: http://web.archive.org/web/20170505034541/http://www.staff.city.ac.uk/~sbbh653/publications/euler.pdf

(hint: there’s some pseudocode in that article which will likely prove helpful)


#4

do it a different way…
put camera’s original rotation controller into the first channel of Rotation List, and new (offset) controller in the second channel. Set the value for second controller as (eulerangles -90 0 90)


#5

another solution is to link a camera to a dummy (for example) , set camera’s position controller as dummy’s pos controller, and add to dummy’s rotation controller value (eulerangles -90 0 90) (without setting a key)


#6

Wow, those are much simpler solutions haha. Thanks!