private void Start() { m_transform = this.transform; // reset the offset distance be 1/3 of the distance from the min to max if (m_settings != null) { m_settings.OffsetDistance = (m_settings.MaxDistance - m_settings.MinDistance) / 3f; m_settings.DesiredDistance = m_settings.OffsetDistance; m_settings.StoreDefaultValues(); m_relativePosition = (m_target.position + (Vector3.up * m_settings.OffsetHeight)) + (m_transform.rotation * (Vector3.forward * -m_settings.OffsetDistance)) + (m_transform.right * m_settings.LateralOffset); m_transform.position = m_relativePosition; } CameraController = this.GetOrAddComponent <EzCameraController>(); CameraController.Init(this); SetLockOnEnabled(m_lockOnEnabled); SetFollowEnabled(m_followEnabled); SetOrbitEnabled(m_orbitEnabled); if (m_checkForCollisions) { m_cameraCollilder = this.GetOrAddComponent <EzCameraCollider>(); } m_stateMachine = new EzStateMachine(); m_defaultState = m_followEnabled ? EzCameraState.State.FOLLOW : EzCameraState.State.STATIONARY; SetState(m_defaultState); }
public void ReplaceSettings(EzCameraSettings newSettings) { if (newSettings != null) { m_settings = newSettings; m_settings.StoreDefaultValues(); } }