First Person Cinemachine Camera

Any advice for configuring the cinemachine camera to work in First person?

I tried moving the “camera focus” object to be just a bit in front of the player model’s head, and created a virtual camera with the below settings:

It doesn’t work quite right. The camera becomes very jittery, especially if you are moving the mouse diagonally. Also, the player model keeps walking in front of the camera while moving. I have damping set to zero, and re-centering disabled.

The only thing I can think of is to use the Third Person Follow in the Virtual Camera. Set the object to follow to be an empty GameObject attached to the character maybe 10 or 12 units ahead of the character, and adjust the framing settings to put the camera between the player and the follow object.

It’s probably worth asking if cinemachine is even meant to support a first person view? I looked around a bit online, and it seems pulling this off requires an extensive amount of customization and tweaking, including scripts to properly handle mouse movement.

I did try using Third Person Follow, with the focus a bit further in front of the player. Sadly, the result was the same as using Hard Look At.

What is confusing is that there doesn’t seem to be a way to fully turn off damping. I set every damping related field to zero, but the camera still pulls back when the character moves.

Also, there is a lot of jittering and random repositioning when moving the mouse, as if the x and y axis are competing for control? Not sure how to explain it.

played around a bit more with different combinations. I think Framing Transponder and POV works the best, its just a matter of finding the sweetspot with the settings.

Turns out the jitter was because I forgot to add and hookup the Input Provider. Once I added the component, the mouse controls became much better.

I now have it so that the camera is in first person, and the player can look down and see their body. The issue remains the clipping. during certain animations, the characters head will clip into the camera and become visible form the inside. Also, if you spin the mouse around, you can see your characters face. I think I can fix this by adding a method to the free look state to spin the player in the direction of the horizontal input.

It definitely would be nice if they would have just put in a First Person Camera.

Ive been making gradual progress on this. I added a simple method to PlayerFreeLookState:

    private void FaceCameraDirection()
    {
        stateMachine.transform.rotation = Quaternion.Euler(0, stateMachine.MainCameraTransform.eulerAngles.y, 0);
    }

which gets called twice in Tick():


    public override void Tick(float deltaTime)
    {
        if (stateMachine.InputReader.IsAttacking)
        {
            stateMachine.SwitchState(new PlayerAttackingState(stateMachine, 0));
            return;
        }

        Vector3 movement = CalculateMovement();

        Move(movement * stateMachine.FreeLookMovementSpeed, deltaTime);
        stateMachine.Controller.Move(movement * stateMachine.FreeLookMovementSpeed * deltaTime);

        if (stateMachine.InputReader.MovementValue == Vector2.zero)
        {
            FaceCameraDirection();
            stateMachine.Animator.SetFloat(FreeLookSpeedHash, 0, animatorDampTime, deltaTime);
            return;
        }

        stateMachine.Animator.SetFloat(FreeLookSpeedHash, 1, animatorDampTime, deltaTime);
        //FaceMovementDirection(movement, deltaTime);
        FaceCameraDirection();
    }

I call it from within the if statement, otherwise the body won’t rotate if the player isn’t moving. The same effect is achieved by calling FaceCameraDirection() at the beginning of the method, of course. Im not sure which way is better, I only did it this way to hedge against issues down the road, although it probably doesn’t matter which way it’s done.

With this, the body will turn to face the camera direction, so FPS view looks more natural. Im still getting a lot of clipping when the head moves in front of the camera. Im wondering how other games do this? Should I make the head a separate game object that doesn’t get rendered by the freelook camera?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms