void Update() { float h = inputMapping.GetHorizontal(); float v = inputMapping.GetVertical(); if (inputMapping.aimMode) { transform.Rotate(Vector3.up * Input.GetAxisRaw("Mouse X") * mouseSensitivity); if (h != 0 || v != 0) { velocity += (transform.right * v - transform.forward * h).normalized * acceleration; } else { velocity -= velocity.normalized * deceleration; } velocity = Vector3.ClampMagnitude(velocity, maxSpeed); } else { transform.Rotate(Vector3.up * h * rotateSensitivity); if (v != 0) { velocity += (transform.right * v).normalized * acceleration; } else { velocity -= velocity.normalized * deceleration; } velocity = Vector3.ClampMagnitude(velocity, maxSpeed); } }