Rotation inverts forward direction
I've got a rigidbody capsule as the player, with attached camera for the fps "mouse look". I am trying to use all force for the rigidbody, but I think the local to world space is messing me up.
When you press "forward" you go forward. Unless you rotate 360 degrees, now forward pushes you backward. Unless you rotate another additional 360 degrees, wherein forward is back to being forward. It is like the mouse rotation is twice the rotation of the rigidbody?
void Mouse()
{
// Mouse X
rotationX = Input.GetAxis("MouseX") * lookSpeed * Time.deltaTime;
rotationX = Mathf.Clamp(rotationX, minimumX, maximumX);
rb.rotation = Quaternion.Euler(rb.rotation.eulerAngles + new Vector3(0f, rotationX, 0f));
// Mouse Y
rotationY += Input.GetAxis("MouseY") * lookSpeed * Time.deltaTime;
rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
cam.transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
}
rb is my rigidbody on my player, while cam is the cam that is a child object of rb. Any help is very appreciated I've been beating my head on the wall for three days trying different methods of applying rotation.
Your answer
Follow this Question
Related Questions
fromtorotation inacurate Help fixing? 0 Answers
Rigidbody Not Rotating 0 Answers
Rolling platform affect player(ball) 1 Answer
Auto levelling,clamped airplane rotation 0 Answers
Script for object to follow player at set distance and rotation, 3D 0 Answers