How should I force a FPP/TPP Character into TPP only during an ability?

desertGhost_

New member
Hi,

I'm trying to restrict certain abilities that I am writing to using third person perspective only. How should I go about doing this?

What I am doing now is:

I assign the cameraController variable in awake if the character is the player character.

C#:
        protected override void AbilityStarted()
        {

            base.AbilityStarted();

            if (cameraController != null)
            {
                startedInFPP = m_CharacterLocomotion.FirstPersonPerspective;

                cameraController.SetPerspective(false);

                canChangePerspectives = cameraController.CanChangePerspectives;

                cameraController.CanChangePerspectives = false;
            }
        }

I restore the camera to its original parameters when the ability ends.

Is there a better way of doing this?

Thanks.
 
Last edited:
That looks correct - that's really similar to how I am doing it for the roll ability.
 
Top