- Home /
Character Controller vs RigidBody for FPS
This is a pretty simple question, but I have not been able to find a definitive answer. I was wondering for a first-person-shooter game should I use a character controller or a rigidbody. I'm still learning about Unity and trying to find the pros and cons of each.
I cannot give you a perfect answer. For a "technical understanding", read the 'Description' part of both in API docs. $$anonymous$$y experience: Rigidbody is VERY painful to make work properly AND smooth, especially for FPS (struggling with this right now btw) control. But from the moment it works, Physics will do everything for you so no more hustle (and this is exatly why I decided to swallow it and struggle with it). On the other hand, Character Controller is super easy to make work, be smooth, etc, but if you want proper collision, falling over, getting crushed by a piano dropped on you, etc, problems start emerging. It also acts sloppy when it comes to collision. It reacts but on an unrealistic ("non-physics" way). $$anonymous$$g. if the player bumps into a chair it won't kick it over but walks over it (if can -slope-, otherwise gets stuck in front of it) etc. So I$$anonymous$$HO: go for CC if you don't plan anything strictly physics-related with the character and happy to "hack" exceptional cases if and when needed, but go for Rigidbody if you want physics to be in control (yet ready to struggle for days or weeks to make it work properly)
Use a CC. It makes things much easier and behavior like pushing or being pushed can easily be added if needed. a RB complicates things alot because it will push even large, heavy objects if the character runs into them, which will probably be a problem in the game if your little soldier pushes a tank around.
@Cherno Like I described... It's a decision. Commenting to note that what you state, "your little soldier pushes a tank" is just not true. If your soldier is 100kg and your tank is 90 tons, your soldier will never push it anywhere. Because of physics... this is what RB is all about. On the other hand, if one goes for RB and faces an issue like that, has to "hack" indeed to make one thing immovable to the other, but not for the rest. $$anonymous$$g. a magic ball that the player can kick away but ignores wind. In this case, could raise the weight of the ball, or temporary set things kinematic, etc. So "cheat physics" basically. Yet, if physics is a must-have for a game, CC will be nothing but endless simulations, workarounds and hacks with a snake code base, legacy on day one.
So I'd stay with "depends" and "whatever the game needs". So I still think my original comment is legit :)
Answer by fuego_see_money · Jun 07, 2017 at 04:34 AM
The CharacterController that is built into unity is a great way to start - if you are still getting used to it, I would recommend using that instead of your own custom Rigidbody + CapsuleCollider combo.
When it comes down to it, of course, creating your own character controller using Rigidbody and CapsuleCollider is going to give you the most customized and optimized result.
For a good transition into learning how to do it yourself, check this out: FPSWalkerEnhanced
^That is the perfect way to learn about making your own controller, because you can actually look at and modify the code.
Hope this helps!