Cinemachine Freelook LookAt stops functioning with custom InputProvider

I am very new to Cinemachine and have been experimenting with setting up a Freelook 3rd person camera for my character.

I’m using Unity’s new Input System and have created a custom IInputAxisProvider. I noticed that the LookAt functioned correctly with the default CinemachineInputProvider, but stopped functioning with mine.
Mine is very simple and right now is just returning the axis values I get from input. The update just Lerps the values down to 0 over time so the camera doesn’t continue spinning when not using the mouse.

I looked at the source of the built in provider and nothing really stood out to me that it was doing something I was missing.
Scratching my head a bit on this one at the moment, so any help is appreciated!

It’s hard to offer much help based only on your description. If you’d like to make a small test project with your code that shows the problem, I could take a look at that.

In setting up a sample project it was functioning correctly, I even tried loading my scene async and additively like I do in my game, in addition to loading my “player” prefab async as well to see if that made any difference.

I went back to my main project and looked over my player prefab again and realized that one difference was that I had my camera and cinemachine camera objects disabled (they are later enabled after the player loads into the scene), while in the test project I just left them enabled.

Sure enough, if I just leave them enabled the LookAt works as expected. Honestly, that’s fine, I don’t remember why I had the camera disabled originally and don’t think it should adversely affect anything for now.

I’m assuming that perhaps the VCamera was not initializing properly or maybe improperly with invalid data? I had originally tried turning it off and back on in the inspector during run time to see if I could trigger any sort of re-initialization, but with no luck.

Anyways, thank you for being a rubber duck and hopefully this is helpful for others. :smile:

1 Like