NokiMo
tarodev
tarodev

patreon


2D Controller using standard Unity Physics

Hey guys,


I've decided to only release this updated version to my patrons and not commit it to the public repo. It works with the standard unity physics system, using a rigidbody and boxcollider. It feels just as good if not better than v1 with the added benefit of it being much easier to use and interact with.

Heads up: it's a breaking change from v1, so if you've altered the code you'll need to manually make those changes on this new version.


You can find it here: https://drive.google.com/drive/folders/1JTkhK1yZSnL0Y-P2zHOb1ay0dAO0t7Lv?usp=sharing


Let me know what you think :)


EDIT: I've just fixed a pretty annoying bug where you get stuck on the corner and also added dash and double jump.

Comments

When you directly use my prefab without adjusting anything, does the jump height remain dynamic or is it always the same? Continuous is a good move. Also decreasing the fixed timestep in the project settings - time menu

(Tarodev) Matthew Spencer

This would be caused by the way I stop continued horizontal velocity when a wall is detected. This can be easily fixed, but I'd need to think of another way to avoid velocity build up. I'm on my phone right now, but it's in the walking section if I'm not mistaken.

(Tarodev) Matthew Spencer

Hello everyone! I'm giving the controller a try for the first time and I would like to ask you more experienced folks. - One thing I noticed is that sometimes the collision fails and the player goes through the ground. I haven't adjusted the variables yet, so the character is a bit faster for my level size, but having that said I changed the 'Collision Detection' of the player rigidbody to Continuous instead of Discrete. Is that something worth doing? - Another thing is that I noticed that my player jumps the same height no matter whether I tap the jump key or hold it. Is there something I may be missing? Thank you

Henrique Machuca

Thanks for this controller, it is really great. The only issue I have is that when I try to push a block, I have to run into it repeatedly instead of the player just pushing it with a constant force. The block is already 0.0001 in mass so I can't make it any lighter. Do you have any tips that might help me with this? Thanks!

Dominic


Related Creators