Camera animation blocks vertical rotation of the camera

Good day,

I current got a game in first person and I want to add a small wiggle when the player is idle (like he’s breathing or whatever). I’ve created an animation and it works fine, but due to the animation my vertical rotation (when looking up/down) is blocked. I’ve found similar questions regarding this matter but most of those were either unanswered or missed context.

My hierachy looks like this:

  • Character - Has the Animator controller and the scripts to move the character

  • Camera

  • More stuff

I’ve tried to move the Animator component to the Camera itself, this didnt work unfortunately.
I’ve also tried to create an empty game object at the same level as the Camera, but that didnt work either.

I didn’t use the premade FPSController (I think its called like this) that unity has, I followed a tutorial for the moving and rotation of the player.

Is there a way to keep the camera wiggle but prioritize the player mouse input? Or keep the rotation in the animation relative to the camera rotation? Or something like this.

If you need more context or information please do say so.

Thanks!

In situations like this, I find it helpful to remember that you can have any number of intermediate Transforms in between. For example, you can have a “camera parent” that controls the main camera movement and then the animation controls its child, which has the actual camera.

So the animation should be on the camera itself? Instead of on the Character parent?

No, you should have:
Character w/ Animator
→ Empty GameObject
—> GameObject with Camera

Your player’s camera control script moves “Empty GameObject”; the Animator makes “GameObject with Camera” move in small ways (breathing, etc).