Ways to Move Player

In this lecture we have used rigidbody.velocity to move the player
whereas in Delievery Driver section we have used transform.Translate()

What is the difference between the three?

Same goes with rotation
in Delievery Driver section we have used transform.Rotate() to rotate the player
whreas in Snow Boarder section we have used rigidbody.AddTorque()


When you use the rigidbody to effect movement, you are essentially moving the object - player in this case - using physics. The physics engine will apply your changes as part of the physics tick and whatever you sent will be affected by the physics.
When you move using the transform, physics is ignored for that movement.

For example; Let’s say your player is facing a wall and is 1 unit away from it. If you use transform.Translate and move the player 1.5 units forward, the objects will move into the wall before the physics will push it out again - provided all the colliders and rigidbodies are set up and in place. If you use the rigidbody.velocity to make the player move 1.5 units forward, it will only move unitl it hits the wall and no further because the physics will prevent it from going into the wall in the first place.

It all depends on the game you are making, and what you are trying to achieve. In other courses we move the player using CharacterController.Move() or NavMeshAgent.SetDestination(). These are all ways to move your player that cater for the game we are making. We use CharacterController in the third-person traversal because it has built-in ground checks and colliders, etc., and we use the NavMeshAgent in the RPG series because it’s a ‘point-and-click’ type game where we click somewhere and the NavMeshAgent will pathfind across the nav mesh we created from where it is to where we clicked (or as close to it as it can).

I think it’s beneficial to learn as many ways as you can to help decide which method would be best for your game.


Thanks for the answer.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms