private void Update() { sphericalCoordinate.Rotate(Input.GetAxis("Mouse X"), 0.0f, Input.GetAxis("Mouse ScrollWheel"), speed * Time.deltaTime); sphericalCoordinate.Rotate(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"), speed * Time.deltaTime); transform.position = Vector3.Slerp(transform.position, sphericalCoordinate.ToCartesian + (pivot.position + alpha), Time.deltaTime * smooth); target = Vector3.Slerp(target, pivot.position + alpha, Time.deltaTime * smooth); transform.LookAt(target); Quaternion newRot = Quaternion.Euler(transform.rotation.eulerAngles + rot); transform.rotation = newRot; }
public void MoveCamera(float horMove, float verMove) { sphericalCoordinate.Rotate(horMove * horRotateSpped * Time.deltaTime, verMove * verRotateSpped * Time.deltaTime); transform.position = sphericalCoordinate.GetCartesianCoord() + targetToFollow.position; transform.LookAt(targetToFollow.position); }
private void Update() { sphericalCoordinate.Rotate(AirVRInput.GetAxis(cameraRig, AirVRInput.Touchpad.Axis.DragX), 0, AirVRInput.GetAxis(cameraRig, AirVRInput.Touchpad.Axis.DragY), speed * Time.deltaTime); transform.position = Vector3.Slerp(transform.position, sphericalCoordinate.ToCartesian + (pivot.position + alpha), Time.deltaTime * smooth); }