Third Person Camera Over The Shoulder?

Juneav

New member
Hi there!
Hope you are doing OK.
I have been playing around for a while and I have not been able to achieve this kind of movement: over the shoulder - like in moder games style...
Dead Space, The Last Of Us, Resident Evil, Hellblade, etc., those games implement an over the shoulder camera style very similar to the Combat Movement / Camera components in the UCC, but with some differences:

1. If the character is idle, the camera can orbit around the player and the player does not rotate
2. If the character is idle, then camera orbits and then the character starts to move, the character rotates to look in the direction of the camera
3. While in movement, the character moves in the direction of the camera, but the movement type is like combat: forward, strafe left, strafe right, walk backwards...

How can I achieve this type of movements?

I have tested with "Update Character Rotation" check box in the camera, but this does... nothing? No matter if enabled or disabled, the character always rotates.
I have lots of animations with root motion & root rotation, I have the option to use abilities for lets say, start walking forward, left 90°, left 180°, right 90°, right 180° and so on, I have tested combinations of camera & movement types, used 2d freeform cartesian controllers, all states looking good and working correctly in the inspector, however Im not able to achieve this kind of movement. The closer combination is of course Camera Combat & Movement Combat, however Im not being able to achieve the movement style I described before. Can you help me on this? What is the list of things I would need to setup so I can achieve this? Do I need to create new movement styles?

I believe that for my starting states I need a parameter like yaw, but the one in the controller never changes with this setup, and for the rotation during movement, I dont see how can I get it too.

Please your help!
Thanks!
 
For this you have to implement your own view/movement type combination that combines elements from the combat (strafe/backward movement) and adventure (camera orbit when idle) types.
 
I managed to achieve something very similar to this by switching between combat and adventure with a transition time. I did it using states and presets to change between combat and adventure. I think in addition to what you listed, i also switched to adventure when running, which was blocked by aiming. iirc this last one is how RE2 works. Importantly, I dont think it required any custom scripts or codes. I have a demo here of how it can look - also mixed with state controlled topdown: https://drive.google.com/file/d/1E2Z16rKXzeHR3EemnBw9v71BZLxWynPN/view
 
I managed to achieve something very similar to this by switching between combat and adventure with a transition time. I did it using states and presets to change between combat and adventure. I think in addition to what you listed, i also switched to adventure when running, which was blocked by aiming. iirc this last one is how RE2 works. Importantly, I dont think it required any custom scripts or codes. I have a demo here of how it can look - also mixed with state controlled topdown: https://drive.google.com/file/d/1E2Z16rKXzeHR3EemnBw9v71BZLxWynPN/view
Hi there! This seems like a very good solution to the case, but can you share some screenshots of your setup in the inspector? Thank you!
 
Hopefully the attached gives you some idea. note the transition and also that some presets block others. Thew presets are small but essentially you type out the full movement/view type name.

Forgot to mention it is exploiting the default thirdperson state name as specified on the locomotion component and you will likely want presets for idle and aim, etc.
 

Attachments

  • res evil settings.png
    res evil settings.png
    169.1 KB · Views: 11
Hopefully the attached gives you some idea. note the transition and also that some presets block others. Thew presets are small but essentially you type out the full movement/view type name.

Forgot to mention it is exploiting the default thirdperson state name as specified on the locomotion component and you will likely want presets for idle and aim, etc.
Thank you very much! I will experiment whit these tonight! I'll share my results:D
 
Thank you very much! I will experiment whit these tonight! I'll share my results:D
Hi Dank!
I spent the day thinking in your suggestion about using camera transitions and states, and I came with an idea: what if I have a script that checks for movement and depending on it switches to adventure/combat cameras and movements? And guess what, it worked! By using a simple script that creates these seamless transitions (thank you very much for the suggestion!) Im able to achieve this type of cameras/movements like in the games I mentioned, and whats even better is that by checking the character speed I have even more flexibility to add an adventure movement type on the character if it was idle, then moving (strafing) and then switching to a run (adventure) by changing the speed, just as you correctly said it is implemented in RE2 (you obviously know your way, I didnt remeber this and had to re install it again lol).

Thanks to Christian also for replying to my question, and for everyone who comes accross a case like this, heres the script and a video of the results (still not implementing the last run check but that can be done easily).

https://drive.google.com/file/d/1PZ5ngDqHess_zQKRmhicCVPVGK0l4fDL/view?usp=sharing

Code:
using Opsive.UltimateCharacterController.Camera;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.Character.Abilities;
using UnityEngine;

public class ThirdPersonShoulder: MonoBehaviour
{
    public GameObject m_Camera;
    public GameObject m_Character;
    private CameraController m_CameraController;
    private UltimateCharacterLocomotion m_CharacterLocomotion;
    private string m_CameraViewTypeAdventure = "Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes.Adventure";
    private string m_CameraViewTypeCombat = "Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes.Combat";
    private string m_CharacterLocomotionMovementTypeAdventure = "Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes.Adventure";
    private string m_CharacterLocomotionMovementTypeCombat = "Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes.Combat";
    private Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes.Adventure m_AdventureViewType;
    private Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes.Combat m_CombatViewType;
    private Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes.Adventure m_AdventureMovementType;
    private Ability m_SpeedChangeAbility;
    public bool m_IsMoving = false;
    public bool m_IsWalking = false;
    public bool m_IsRunning = false;

    private void Awake()
    {
        m_CameraController = m_Camera.GetComponent < CameraController > ();
        m_CharacterLocomotion = m_Character.GetComponent < UltimateCharacterLocomotion > ();
        m_SpeedChangeAbility = m_CharacterLocomotion.GetAbility<SpeedChange>();
    }

    private void SetCameraViewTypeAdventure()
    {
        m_CameraController.SetViewType(Opsive.Shared.Utility.TypeUtility.GetType(m_CameraViewTypeAdventure), true);
    }

    private void SetCameraViewTypeCombat()
    {
        m_CameraController.SetViewType(Opsive.Shared.Utility.TypeUtility.GetType(m_CameraViewTypeCombat), true);
    }

    private void SetCharacterLocomotionMovementTypeAdventure()
    {
        m_CharacterLocomotion.SetMovementType(Opsive.Shared.Utility.TypeUtility.GetType(m_CharacterLocomotionMovementTypeAdventure));
    }

    private void SetCharacterLocomotionMovementTypeCombat()
    {
        m_CharacterLocomotion.SetMovementType(Opsive.Shared.Utility.TypeUtility.GetType(m_CharacterLocomotionMovementTypeCombat));
    }

    private void Update()
    {
        if (m_IsMoving != m_CharacterLocomotion.Moving)
        {
            m_IsMoving = m_CharacterLocomotion.Moving;
            if (m_IsMoving)
            {
                SetCameraViewTypeCombat();
                SetCharacterLocomotionMovementTypeCombat();
                Debug.Log("Switched to Combat!");
            }
            else
            {
                SetCameraViewTypeAdventure();
                SetCharacterLocomotionMovementTypeAdventure();
                Debug.Log("Switched to Adventure!");
            }
        }
        if (m_IsMoving && m_SpeedChangeAbility!= null)
        {
            if (!m_SpeedChangeAbility.IsActive)
            {
                m_IsWalking = true;
                m_IsRunning = false;
            }
            else if (!m_SpeedChangeAbility.IsActive)
            {
                m_IsWalking = false;
                m_IsRunning = true;
            }
        }
        else
        {
            m_IsWalking = false;
            m_IsRunning = false;
        }
    }
}
 
Top