Search Unity

Mecanim Locks Camera FOV

Discussion in 'Animation' started by kilogold, Dec 13, 2014.

  1. kilogold

    kilogold

    Joined:
    May 28, 2013
    Posts:
    9
    Hi all,
    I am having issues with Mecanim not allowing me to modify FOV when running.
    This only happens if any animation in the animation controller interacts with the camera's FOV, regardless of whether it is being played or not.
    I noticed the legacy animation system does not have this problem, which leads me to believe Mecanim hijacks the camera behavior when manipulating its state machine.

    I don't know if this in an undocumented behavior, a bug, or I simply do not know how to properly leverage mecanim, so I'm hoping the wonderful people of this forum can help me out with this.

    The best way to explain this is probably to see it firsthand.
    I have included a basic project with only the animation behavior (using Unity3D v4.6.1f1).
    The animation names and context are irrelevant, but for the sake of information simply assume a tower defense kind of game where a camera animation would take place to switch between build & combat views.

    Allow me to guide you through the two steps to reproduce the problem:

    Step 1:
    Open the project and look for Assets/Mecanim/MecanimScene.unity.
    Play the scene in the editor, and try to manipulate the camera's FOV.



    Notice the animation controller is running:



    Step 2:
    Disable the animation controller, to release the lock on the camera's FOV.



    Attempt to modify the FOV, and notice how we can manipulate it now.




    The animation manipulating the camera's FOV (and the only one in the project with actual keyframes) is BossView .
    We can see the same animation view in both Dope Sheet & Curves below:


    My observations are that the camera's FOV value is locked to the initial value of the scene; in other words, the locked FOV value is completely irrelevant to the values in the animation.

    My goal is the be able to dynamically manipulate the camera (that includes the FOV) in any way I like until it's time to use the animation for a predefined transitional behavior.

    Is this possible?
    Am I doing something wrong?

    The only workaround we've come up with is disabling the animation controller whenever we want to deal with the camera dynamically. This can still be a problem, since some of the animations in mind allow user-input to manipulate the camera during an animation (example: animated panning, while user can manually zoom in/out).

    Any help is appreciated!
     

    Attached Files:

  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790

    Hey @kilogold - please don't take this wrong, but I believe you were doing something incorrectly with your implementation of camera FOV manipulation while using mecanim, though I don't have a solution minus maybe the edits to the FOV were done while in play mode. Probably not the correct answer.

    Care to share what the problem was so if future developers run into the same problem they can reference this thread for a solution?

    Hope you got it working- :)