public void Update() { if (!_keyboardController.IsControllerCaptured()) { return; } Vector3 cameraPitch = _cameraPitch.transform.localEulerAngles; Vector3 cameraPivot = _cameraPivot.transform.localEulerAngles; cameraPitch.x += Input.GetAxis("Mouse Y") * MouseSensitivity * -1.0f * Time.deltaTime; cameraPivot.y += Input.GetAxis("Mouse X") * MouseSensitivity * Time.deltaTime; if (cameraPitch.x > _overheadClampAngle && cameraPitch.x < _underCharacterClampAngle) { if (cameraPitch.x < 180.0f) { cameraPitch.x = _overheadClampAngle; } else { cameraPitch.x = _underCharacterClampAngle; } } _cameraPitch.transform.localEulerAngles = cameraPitch; _cameraPivot.transform.localEulerAngles = cameraPivot; }
public void Update() { if (_controllerCollider.isGrounded) { _velocity = Vector3.zero; ConnectWithFloor(); } else { // Apply Earth gravity _velocity += ((Vector3.up * -1.0f) * 9.807f) * Time.deltaTime; _velocity += (-_velocity.normalized * _windResistance) * Time.deltaTime; } if (_keyboardController.IsControllerCaptured()) { UpdateGrappleMovement(); if (!_isGrappling) { UpdateGroundMovement(); } #if UNITY_EDITOR Debug.DrawLine(transform.position, transform.position + _velocity * 10, Color.blue); Debug.DrawLine(transform.position, transform.position + _heading * 10, Color.red); #endif } _controllerCollider.Move((_heading + _velocity) * Time.deltaTime); }