How to build precise and direct Mario-like 2D movement?

Dear commUnity,
I’ve been learning to use Unity for like 5 months now. Though I already made most of the Walker Boys tutorials, I am still not satisfied with the result at all. Especially with the 2D mario clone they teach to create in Lab 4.
The character controller is very unprecise, at least as far as I noticed, when it comes to create precise controls and collision detection like you know it from every 2D Mario game… or Braid, if I had to name a newer example.

I want to create a highly precise control scheme to make my upcoming 2D game projects as good as possible. The key aspect is the precise and direct movement of the main character. So, I would like to ask you:
How do one create highly precise Mario-like 2D movement in Unity? Is there any other way to do this beside “pushing the pill around” with x and y Translate and gravity statements? Is it even possible to achieve my demanded result and quality with “standard” Unity methods?

(If there is a topic existing on this subject, I am sorry to open another one. I did not find one with the search function of the board.)

I’d appreciate your help.
Thank you for reading my topic.

~Aries

Hmm. Don’t really get what you need. The Character controller is quite restricted. You might want to take a look at using Rigidbodies to make your character.

Hi there.

What I mean is:
The tutorials by the Walker Boys teach you how to work with 2D sprites and stuff and how to build levels but not how to make everything very precise and intuitive and really Mario-like. The controls feel a bit hesitating, difficult to describe, you have to feel what I mean. For example, the character sprite is still like 5 pixels off a wall when jumping towards it.

The bounding box around the character might be too big. It’s not that involving to write your own collision detection why not give it a go? Essentially you check for not hitting a bounding box rather than hitting it. eg If the right hand edge of the char box is less than the left hand edge of the target box then they aren’t colliding.

With the theory under your belt others implementations will make more sense.

Ok, now I know two ways in moving the figure. With the CC and with the Rigidbody / Box Collider combo.

However, both variations got their flaws:
The CC slides a bit when the arrow key is up again, has correct collision detection but the figure slips through the textures very often (and falls to infinity).
The rigidbody is highly precise in movement and really feels like Super Mario but the collision detection is buggy.

For variation 2:
The figure keeps stuck in walls or sliding down awkwardly when jumping towards them and still pressing the arrow key. Plus, it is not as precise as the collision detection of the character controller. I want the figure to just continue to fall like normal and contact the wall correctly. Like in Super Mario World, my reference game.

http://ariest.de/Unity/Pixel/WebPlayer.html

This is what I could come up with.

Is it possible to mix those two worlds? Having the precise collision detection (without sliping through nanometer holes the engine produces) of the CC and the very direct controls of the “selfmade” rigidbody / box collider combo, like I use them in the web demo?

I have this issue as well, where if you hold input in the direction of the collision you will “stick” to it. I haven’t come up with a clean way to negate that behavior yet, but if I do, I’ll share it here.

Another issue I found doing this same variation is if I put one collider at an angle (like an inclined ramp) with the collider merging through the floor collider, if I land just right (where the two meet), my player will be somewhat stuck unable to move. Though the player isn’t stuck but rather is slowly “gliding”. I’m not sure how to best combat this. -_-

EDIT: Figured out my slow gliding issue, it was related to some crappy collision code I wrote prior. Just using the plain collisions doesn’t cause this issue.

UPDATE: I managed to get around my issues by learning how to properly use the CharacterMotor script that comes with Unity. Using rigidbodies along with my own collision logic wasn’t working out too well and was pretty much reinventing what CharacterMotor was meant to do. I just have to set the parameters they way I want, then feed the character motor script my movement input and it pretty much handles the rest.