2D character controller - physics driven VS manual

So I'm trying to figure out (or better: learning by doing) whether a 2D sidescrolling character controller not driven mostly by physics is actually the better approach or if a similar result can be achieved by using Physics2D more easily.

I've been starting to use my current free time to create a plattformer. The basis for my character controller is currently physics driven with the basis of @Mike-Geig 's training session for a 2D character controller.

The thing is that I've hit a few obstacles in terms of character behaviour. It's the largest personal project I've created so far so of course there are going to be problems. Yet I was wondering if it's actually better for a 2D game to have a custom player controller that isn't driven by physics ... if it's worth it.
For example: it's pretty difficult in physics to set a precise jumping heigt and speed for a character
Also it's difficult to get the acceleration and stopping distance of a player "right" (with 'right' being a very subjective measurement to physics just feeling spongy and sometimes not in the right way responsive). There are other things - probably a lot I don't even know about yet.

So I'm currently following the super awesome tutorial series by @SebastianLague - which is really great (and should also be added to the official library of Unity training, IMO). But it's obviously for me as someone with a focus on art rather than programming: it's just a little too much. In essence it's implementing a completely custom physics system for a player character.

So I was wondering ... is it worth it?
Can the same results and ease of use as with a custom 2D controller be achieved with physics?
What do you guys/gals prefer to use and why?
Should Unity integrate a 2D character controler like the one for 3D assets or is it better to build this thing from the ground up individually?

1 Like

I've only built a few 2d games but I use a custom movement. This is personal preference as to me 2d games make me think of the old arcade games & my memory of them is every thing just happened, there was no acceleration or deceleration, jump height was always the same etc.

I guess it depends on what feel you are going for overall with the game

So what did you do with your custom character controller?
Did you pretty much implement the complete physics replacement yourself?

Yeah, but as I'm still beginning I don't do complex physics yet, mainly move, jump, shoot, wind pushing the player,
Moving on ice I used the physics add force stuff as that gives the effect of starting to move slower & then sliding to a stop.

Hi,

Yeah, i followed that same tutorial and ended up regreating it as you end up losing all the other stuff, like the effectors, might not work very well with joints and other elements. So far, for my 2D, i’m using a fully “compliant” physics controller :slight_smile:

So how did you setup your character controller to be able to walk slopes but also still be responsive in jumping and don't looking like a feather when falling to the ground again?

I had artificial gravity applied to the rigid body when the character wasn't grounded, which I tweaked until it looked right when they fell.

Slopes: Add force to the rigid body and have a circle collider at the bottom. He will do just fine :-)
Falling: Your scaling is wrong. I had the same error, it was due to everything being too big. Try to scale down everything or, in the worst case if you can't scale it down: increase both Gravity (before i scaled down, i had it up to 98 instead of 9.8 o_0) and the jump force.

I would advise to scale it down, thou

Oh, I had to use ForceMode2d.Impulse for the jump to work like i wanted (second parameter of the addForce method in rigidBody2D).

I know I am necro-posting but this thread is the first result when Googling for “unity 2d using physics VS programmed tweens” and I felt the need to correct the quoted misinformation.

Old arcade platformers starting around “Super Mario Bros” absolutely had acceleration/deceleration, variable jump heights based on length of button being held down, etc. It’s part of what made the game stand out as a major improvement over what existed prior. (Heck maybe even Mario Bros did too but it wasn’t as well refined).

1 Like