void SwitchCamera(Transform t) { if (onLock && t) { if (t != player) { lockIcon.gameObject.SetActive(true); PositionConstraint pc = lockIcon.GetComponent <PositionConstraint>(); if (pc) { if (pc.sourceCount > 0) { pc.RemoveSource(0); } constraintSource.sourceTransform = t; constraintSource.weight = 1; pc.AddSource(constraintSource); //pc.translationOffset = Vector3.zero; //pc.translationAtRest = Vector3.zero; } lockVcam.GetComponent <CinemachineVirtualCamera>().LookAt = t; lockVcam.GetComponent <CinemachineVirtualCamera>().Priority = mainPriority + 1; return; } } lockIcon.gameObject.SetActive(false); lockVcam.GetComponent <CinemachineVirtualCamera>().Priority = mainPriority - 1; }
public void ChangeCurrentAngle(float xOrY, bool XTrueYFalse) //bool is true if input float is x, false if input float is y { if (XTrueYFalse) { CurrentCamera.GetComponent <CinemachineFreeLook>().m_XAxis.Value = xOrY; } else { CurrentCamera.GetComponent <CinemachineFreeLook>().m_YAxis.Value = xOrY; } }
bool ObjectHasCollider(object obj) { CinemachineVirtualCameraBase vcam = obj as CinemachineVirtualCameraBase; var collider = (vcam == null) ? null : vcam.GetComponent <CinemachineCollider>(); return(collider != null && collider.enabled); }
public void AddToMasterList(CinemachineVirtualCameraBase camToAdd) { _masterList.Add(camToAdd.name, camToAdd); Debug.Log("Add " + camToAdd + " To master list"); _masterCamListNames.Add(camToAdd.name); if (!camToAdd.GetComponent <VirtualCameraControllerBase>().isStartingCam) { camToAdd.gameObject.SetActive(false); } else { _activeCam = camToAdd; } }
CinemachinePostFX GetEffectivePostFX(ICinemachineCamera vcam) { while (vcam != null && vcam.LiveChildOrSelf != vcam) { vcam = vcam.LiveChildOrSelf; } CinemachinePostFX postFX = null; while (vcam != null && postFX == null) { CinemachineVirtualCameraBase vcamBase = vcam as CinemachineVirtualCameraBase; if (vcamBase != null) { postFX = vcamBase.GetComponent <CinemachinePostFX>(); } if (postFX != null && !postFX.enabled) { postFX = null; } vcam = vcam.ParentCamera; } return(postFX); }
public void Initialize() { impulseSource = m_virtualCamera.GetComponent <CinemachineImpulseSource>(); }
public void PreInitialize() { vCamRecomposer = virtualCamera.GetComponent <CinemachineRecomposer>(); }
void Start() { mainPriority = mainVcam.GetComponent <CinemachineFreeLook>().Priority; }
void Start() { // Tell the camera to follow the player once the player exists (it will be instantiated by FPECore) cameraToTrigger.GetComponent <CinemachineVirtualCamera>().LookAt = FPEPlayer.Instance.gameObject.transform; turnOffCamera(); }