How to automatically orientate character when character enter the field

ebiflychan

New member
Is there a way to centre the camera on a certain transform when the character enters an area?
Viewtape is a third person adventure.
I'd like to have the camera angle transition to face the mountaintop when character enter an open area, like in the video below, and hold it for a few seconds before returning to normal. The video is manual.
I've tried using the aim assist in the agility pack, but I don't think it's a good way to do this.
Is there any way to get the direction the camera is facing around the character?
Do I need to implement the LookDirection method?
Do I need to change the max distance in the aim assist script for each object or set a state preset for each object?
 
Last edited:
I was able to do this by switching the view type in the cinemachine integration, but I wasn't able to transition the view type and return to the previous gaze when I switched back to the third person adventure.
I want to switch the view type of the camera controller when it responds to a collider trigger. I tried to switch the view type using the API but it doesn't work.
C#:
using UnityEngine;
using Opsive.Shared.Camera;
using Opsive.Shared.Utility;
using Opsive.UltimateCharacterController.Camera;

public class MyObject : MonoBehaviour
{
    [Tooltip("The character that should be assigned to the camera.")]
    protected GameObject m_Character;

    /// <summary>
    /// Sets a third person perspective on the Camera Controller.
    /// </summary>
    private void Start()
    {
        var camera = CameraUtility.FindCamera(null);
        if (camera == null)
        {
            return;
        }

        var cameraController = camera.GetComponent<CameraController>();
        cameraController.Character = m_Character;
        cameraController.SetPerspective(false); // false indicates the third person perspective.

        // Switch to the third person Combat View Type.
        var viewTypeName = "Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes.Combat";
        cameraController.SetViewType(TypeUtility.GetType(viewTypeName), false);
    }
}
Even though the camera controller script is attached to the main camera, I get the following error.
1630259790883.png
Also, what is the view type name of the cameracontroller's third person cinemachine?
That is just "Cinemachine".
1630261459072.png
 
Last edited:
For this I would use something like Cinemachine and then switch to the character controller's camera. Instead of using the Cinemachine ViewType you should completely switch the camera controllers. This is what we do within the upcoming Adventure Kit and it works really well.
 
Top