Hi. I’m working on a 2D game with my friend, completely new to game development. For movement, it’s tempting to use rigidbody to make the physics easier to do and more realistic. However, I need full controll over the character movements from time to time. Is player controller, rigidbody, or something else the best way to do this?
rigidbody is much more flexible in the long run, say if you decided you want the player to be thrown back by an explosion or some force it would be much easier with rigidbody. you can alter the velocity directly so the world is your oyster with one.
What about the Rigidbody2D doesn’t give you “full control”? There are three different body-types available, not simply Dynamic which gives you dynamic collision detection and response, gravity, forces etc. There’s Dynamic, Kinematic and Static.
Use Kinematic and it does nothing. You ask it to move, it moves. It doesn’t get moved by anything it touches, isn’t affected by gravity etc.
There’s far too much misinformation around about Rigidbody(2D) due to lack of understanding so I would suggest looking at the three available body-types, which are common across pretty much all physics systems both 2D and 3D, to see what suits your needs.
Know though that colliders don’t move (ever!) but Rigidbody do and colliders are attached to them so you should never modify the Transform as this just causes a Collider without a Rigidbody2D to be recreated from scratch so bad for performance. Add a Rigidbody2D, select the body-type which suits and always use the Rigidbody2D API to cause movement i.e. MovePosition, Velocity etc.