I am an intermediate C# and Unity user. I was trying to decide (the age old question) of using rigid body or character controller for my player’s movement.
I figure if I explain my goals I could get some really direct feedback.
I want to have my character sprint, long jump, slide, roll, wall run, walljump and hold and slide, double jump, glide.
Looking around I see two conflicting viewpoints, create my own physics for more control or use the unity character controller and fake physics interactions.
What are some of your more experienced thoughts? Where can I start, heck where SHOULD I start?
It sounds like you want a precise control over your motion. With a right setup this is doable with physics engines, but I wouldn’t go that route.
In my mind, if a game doesn’t have numerous physical interactions and is an opposite of a simulator (i.e. arcade), then custom (or faux) physics is the right thing to do.
Not only you have much greater control (potentially; it really depends on your design), but it is also more performant and easier to debug. On the other hand, you need to invest more time in finding a proper design for the features you want to implement.
Now, if you get lured by the proposition that the hard things were already made for you in any physics engine, that’s reasonable, but try thinking in the long term. You will end up wasting same or more time along that route, with potentially severe bugs that you have no control over, think of glitching through walls, sticking to geometry, jerky motions, configuring all kinds of demanding colliders all over the place, fiddling with fake forces only to enable unnatural movement paths then having to unnaturally abort them, etc.
For a game like that, you need to keep it simple and deterministically predictable. Hence custom.
Other people may have their own opinions, so it’s not something that’s universally treated the same.
That said, such games in real production typically use hybrid systems, to fool the player into thinking the game is full physics enabled.
Thank you for your response! Faux is definitely what I am thinking, but i didn’t understand, does that mean you think I should go with a character controller then? Edit: Because my understanding is the character controller allows for that kind of Faux physics system.
Doing the character controls yourself gives you a lot more control. I’d personally always go with that, unless your character literally is based on physics. Examples for this would be puzzle games, where you control some ball or block and stuff basically just needs to move according to physics. Or angry birds / flappy bird/ … like games.
Both are two sides of one coin tho. The character controller starts at perfect control, but you will have to implement some features yourself to make it look smoother and more natural. The physics based approach is by definition natural, but you will have to implement features yourself to give you proper control over it - which arguably is harder to do.
So your choice should depend on which side you are closer to. And as far as im concerned, you dont seem to require physics for what you attempt.
Well, why not, you don’t want to reinvent every wheel along the way. If you can reuse the basic logic of collision detection from a physics module, so why not, it’s a separate thing from having to play with interactable rigid bodies. And collision in general tends to be very hard to implement anyway. (very hard)
I’d make some sort of special box colliders that are used as zones, enabling certain features and motions, for example walljumps and glides can be made so that you have a context-aware system that is able to discern the kind of motion you want/need from a set of ongoing parameters.
In that sense, you basically treat your character’s motion as a state machine, and use the computationally-simple environment (as well as user input) to help you switch between the states.
Just as Yoreki said, you are deciding here between two routes, one of which is low risk, medium-to-maximum reward, and the other is high risk, medium reward (considering what you’re trying to achieve). If you plot the two, the high risk one will appear to lift off faster at the beginning, but it caps off pretty soonish after you start to appreciate how hard it is to model a fun game with real world physics.