Camera Look Offset

Arlo

New member
Hi there!
I can see that through script it's easy to access other settings like the Anchor Offset, but how to change the Look Offset of the active ViewType through code?
Thanks!
 
Hello, you can manually change the Look Offset from the view type like this :

C#:
using Opsive.UltimateCharacterController.Camera;
using Opsive.UltimateCharacterController.ThirdPersonController.Camera.ViewTypes;
using UnityEngine;

public class CameraOffset : MonoBehaviour
{
    public CameraController cameraController;
    Adventure adventureView;

    public void OffsetTest()
    {
        adventureView = cameraController.GetViewType<Adventure>();
        adventureView.LookOffset = new Vector3(0, 0, 0);
    }

}

However, it's recommended to use the State System for that : https://opsive.com/support/documentation/ultimate-character-controller/state-system/

The Camera Controller and its View Types both contain state and preset slots. Also, remember that the default values matter, for example if you call this manual modification, then press right click to aim, this will by default activate another modification through state, and the look offset will revert to the initial default value once aiming is stopped.
 
Top