void CursorPos() { if (this.mode == CursorMode.Dynamic) { if (objectHit) { if (this.type == CursorType.Head) { movePos = DWCameraRig.Instance.GetHitInfo().point - this.cursorCenter.forward.normalized * objectOffset; } else if (this.type == CursorType.Phone) { movePos = phoneControl.GetTargetInfo().point - this.cursorCenter.forward.normalized * objectOffset; } this.transform.position = Vector3.Lerp(this.transform.position, movePos, Time.deltaTime * cursorMoveSpeed); } else { movePos = this.startPos; this.transform.localPosition = Vector3.Lerp(this.transform.localPosition, movePos, Time.deltaTime * cursorMoveSpeed); } } else if (this.mode == CursorMode.NormalFacing) { if (objectHit) { Vector3 newDir = new Vector3(0, 0, 0); if (this.type == CursorType.Head) { newDir = DWCameraRig.Instance.GetHitInfo().normal; } else if (this.type == CursorType.Phone) { newDir = phoneControl.GetTargetInfo().normal; } transform.rotation = Quaternion.FromToRotation(Vector3.forward, newDir); if (this.type == CursorType.Head) { movePos = DWCameraRig.Instance.GetHitInfo().point + newDir * objectOffset; } else if (this.type == CursorType.Phone) { movePos = phoneControl.GetTargetInfo().point + newDir * objectOffset; } this.transform.position = Vector3.Lerp(this.transform.position, movePos, Time.deltaTime * cursorMoveSpeed); } else { movePos = this.startPos; this.transform.localPosition = Vector3.Lerp(this.transform.localPosition, movePos, Time.deltaTime * cursorMoveSpeed); this.transform.rotation = cursorCenter.rotation; } } }