- Home /
handmade player object goes through walls
Hi all, I really hope you can help. I've been trying all day to stop my player object moving through walls in my game. I've only been using Unity a couple of weeks so I'm totally lost and tried searches and have changed and unchanged colliders, rigidbodies, etc so many times I've lost count. It's a basic fps controller that is navigated by arrow keys through the level. Walls are made of basic cubes
void FixedUpdate ()
rigidbody.transform.position += Input.GetAxis("Vertical") * transform.forward*speed;
Comment
Don't move a rigidbody with .position or Translate. You will teleport. Use AddForce of $$anonymous$$ovePosition.
Search Unity Rigidbody on google and look at the Scripting API