Unity 2017 Beginner Tutorial 3 – Using Rigidbody to move an object

In my previous tutorial, I used the transform.translate() function to move my main character, which resulted in a bug – the player gets absorbed into a wall. This is because the main character is not considered as a physics object when you move it with transform.translate(). So in this tutorial we learn how to declare a rigidbody variable, how to assign the player’s rigidbody component to this variable, and then how to use the rigidbody.movePosition function to move the player, so that it will collide properly with the wall.