How do I make Rigidbody movements in a first person shooter in Unity?

So I am making an FPS game in Unity, and I used to use transform.translate for movement, but that allows the player to move through walls if moving fast enough (diagonal movement) and it doesn't even matter how large the wall's hitbox is.

Here's my Player Controller code:

Here's the movement code: void FixedUpdate() { //myBody.MovePosition(transform.position + (transform.forward * Time.deltaTime * speed)); }

void Update()

float axisX = Input.GetAxis ("Horizontal"); float axisY = Input.GetAxis ("Vertical");

Read more here:

Content Attribution

This content was originally published by Taylor Umongus Has at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: