While the types of games and experiences you can build in Unity are practically endless, chances are any game you can think of will probably involve moving something across the screen. Whether your game is about animating a word for a word puzzle game, stepping on monsters as a psychedelic mushroom eating plumber, or blasting away the forces of evil with a BFG. As a result Unity provides many different methods for moving things around, which can be confusing to wrap your head around initially.
In this short article I provide a list of functions and a short description on how they are used. This list is not exhaustive, I’m sure there are others that I have missed. No movement method is strictly better than the others. Which function to use depends on the scenario.
Basic Movement functions
These functions move the character based exactly on the inputs you provide. They are typically the simplest and most straightforward to use. The downside of these movement functions is that they typically ignore physics or have funky interactions with physics and other objects.
Movement functions using Character Controllers
These types of movements require a character controller to be associated with the moving object. Character Controllers are a mix between physics/collision driven movement and the static movement seen in methods like Linear Interpolation. They were built for games like FPS and Third Person Shooters in mind by , allowing for more finely grained control than Physics, including collisions and basic physics simulation. If you don’t have a complex movement scheme envisioned then use SimpleMove as it does some basic physics for jumping. Use Move if you have some custom behaviors you want to model. Also note that the model is self contained — that is, if you call some sort of function such as AddForce on the parent GameObject, the velocity added by that force will not be reflected in the character controller.
Movement function based on Physics
Use the physics engine to simulate the application on a force with mass. Good for providing realistic physics simulations, but not always ideal for game play movement. It’s hard to do finely tuned controls with Physics, for example, getting something to stop on a dime. However, this type of movement is good for simulating certain games such as realistic racing, or flight sims, or realistic collisions.
Using the Animator or an animation curve to move character
Outside of the scope of scripting is to use animators to move characters or objects. Two popular ways to do this are either to: 1, record an animation curve in the animation window so you can animate objects motion with key frames, or 2, Apply the Root Motion of an animation to make the character move based off of what the animation is doing.