Hello. I wrote a classed called “MovementManager”, and in there, it has a bunch of methods on moving the player. One is called “handleUserInput(Rigidbody rb, float mouseSpeed, float movementSpeed)” and does as the name implies. It works perfectly, but when I call on this method, it causes the rigidbody to not fall, but if i disable the use of this method, it falls.
Any ideas?
Here’s the code;
public static void handlePlayerInputs(Rigidbody player, float mouseSensitivity, float movementSpeed) {
//Handle Mouse X Rotation of Player\\
float RotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity * 50 * Time.deltaTime;
player.transform.Rotate(0, RotLeftRight, 0);
//Move Player Forward at a Constant Speed\\
player.AddForce((player.transform.forward * Time.deltaTime * movementSpeed * 100) - player.velocity, ForceMode.VelocityChange);
//Handle Jumping\\
if (Input.GetKeyDown(InputManager.getJumpKey())) {
player.AddForce((player.transform.up * Time.deltaTime * movementSpeed * 100) - player.velocity, ForceMode.VelocityChange);
}
}