Answers for "how to access tracked object offset value in cinemachine"

C#
1

how to access tracked object offset value in cinemachine

GameObject camObj; //This is your camera with the free look component on it

CinemachineFreeLook freeLook; // this reference the free look component in your camera

//I named this variable comp for "Composer", you can name it however you like. This is the cinemachine component with all the aiming stuff on it
CinemachineComposer comp; 

void Start()
{
	camObj = GameObject.FindWithTag("MainCamera");

	freeLook = camObj.GetComponent<CinemachineFreeLook>();

    comp = freeLook.GetRig(1).GetCinemachineComponent<CinemachineComposer>();
	
    // This is how you get to "Tracked Object Offset" of the rig as well as any other property in the rigs.
    comp.m_TrackedObjectOffset.y = "your value here";
Posted by: Guest on July-27-2020

Code answers related to "how to access tracked object offset value in cinemachine"

C# Answers by Framework

Browse Popular Code Answers by Language