Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Camera Rotation Animation Interpolates Odd Spinning

Discussion in 'Animation' started by ThatProgrammerJack, May 15, 2022.

  1. ThatProgrammerJack

    ThatProgrammerJack

    Joined:
    Jan 6, 2019
    Posts:
    30
    EDIT: Solved the problem by rotating a “container” object on one axis and rotating its child, the camera, on a different axis.



    ORIGINAL

    I'm animating a "wakeup" sequence wherein the main camera rotates to appear as though the player is looking around. I added an initial keyframe to set the camera position on a bed pillow away from the player body (which won't be visible; it's a first-person game) and rotate it up (x-axis -85 degrees) to look at the ceiling.

    All was okay at that point.

    I then added another keyframe after several seconds to rotate the camera on the z-axis to look at the right wall, but when I rotated on the z-axis gizmo, it changed the values of all three axes. I thought it might be fine as the animation would likely handle the interpolation fine. However, when I played the animation to look from up to right as though lying down and looking to the right, the camera spun around before settling on the end position.

    How can I fix this? I know that each axis will rotate as I am rotating somewhat "between" the default origins of the axes, but why do the Timeline curves do such a poor job of interpolating this?
     
    Last edited: May 16, 2022