void resetRotation() { float duration = .2f; if (resetRot != null) { StopCoroutine(resetRot); } resetRot = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(Vector3.zero), duration)); }
void TurnAround(float baseTurnSpeed, Quaternion toLook) { float duration = baseTurnSpeed / turnSpeed; if (look != null) { StopCoroutine(look); } look = StartCoroutine(Interpolater.InterpolateLocalRotation(this.transform, toLook, duration)); }
void ToggleLook(bool _isLocked) { if (index >= targetCollider.targets.Count) { index = 0; } if (isLockedOn != _isLocked && _isLocked == true) { float duration = .1f; if (orient != null) { StopCoroutine(orient); } orient = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(10, 0, 0), duration)); } //The camera aim target object Transform _targeter = target.sourceTransform; isLockedOn = _isLocked; camControl.pitchIsLocked = _isLocked; camControl.enabled = !_isLocked; player.weight = _isLocked ? 0 : 1; target.weight = _isLocked ? 1 : 0; playerLook.constraintActive = _isLocked; look.SetSource(0, player); look.SetSource(1, target); if (targetCollider.targets.Count == 0) { return; } lockTarget = targetCollider.targets[index].transform; _targeter.parent = _isLocked ? lockTarget : player.sourceTransform; _targeter.localPosition = Vector3.zero; _targeter.localRotation = new Quaternion(0, 0, 0, 0); index++; }
public void ZoomTo(Vector3 pos, Vector3 targetPos) { float duration = .2f; if (zoom != null) { StopCoroutine(zoom); } if (shiftFocus != null) { StopCoroutine(shiftFocus); } if (resetRot != null) { StopCoroutine(resetRot); } zoom = StartCoroutine(Interpolater.InterpolateLocalTransform(camControl.offset, pos, duration)); shiftFocus = StartCoroutine(Interpolater.InterpolateLocalTransform(camControl.focusTarget, targetPos, duration)); resetRot = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(Vector3.zero), duration)); }