So I am trying to prototype a 2D platformer like game and trying to figure out the best method that I should be investigating for controlling the player character. I see generally 2 different ways to handle this which is either using Rigidbody2D or using raycasts. The list of things that I am looking to do right now are:
has some sort of gravity like effect
moving side to side
jumping
double jumping
being able to walking up slopes of a certain angle (but prevent it after a certain angle and have the user slide down if they are on that angle or larger)
be able to hang off the edge and pull up
I sure some things might come up later in development if I get that far but these are what I want to get working at least at a very basic level before I move on from the character controller for the prototype (if you watch this video for about 15 - 20 seconds, you will see generally most of the functionality I am looking to achieve:
).
Now I started with the Rigidbody2D since I do want to have some level of gravity in the game (not just the player but items, enemy, etc.) and I can get the first 4 working pretty easy but the 5th is more troublesome (and have not gotten to the 6th). I can move up angles (I am setting Rigidbody2D.velocity for movement as it seems to be the most recommended) but for example if I am walking up an angle and then stop, my character jumps up a little (I am guess because of the forward velocity that is has when I stop applying horizontal velocity for moving side to side, there is still extra vertical velocity).
So I have 2 questions:
Should I be looking at Rigidbody2D or manual raycasts?
Either way that you recommend going, do you have any resources that you would recommend looking at for reference (video tutorials, articles, etc.)?