Physics Platformer being painfully buggy

How do I…

Fix a few of the issues that spawned off of the physics engine, such as:

  • Player being able to stick to walls
  • Player trying to jump over a ground block and getting stuck on the corner of it
  • Player pressing the jump key and going way higher than they are meant to
  • Not physics related but “Point inside object” not being great for an enemy object detecting if there is a wall or pit in front of it, if there is more than one of the same enemy

What is the actual result

I’ve tried a couple of things, but every fix I implement or try to either doesn’t work or causes a worse issue

Related screenshots

image (1) (1)

Here is a game link in case you want to go in and find the bugs yourself

Just to clarify:

  • Your game doesn’t your the platformer behavior
  • You’ve made your own logic using Physics 2 behavior

If you want people to help you debug your own logic, you have to give your events.

Basic Motion:
Screenshot 2024-03-13 9.53.39 AM

Tried to the wall stick with the inverse collision, but that doesn’t work well, plus it makes the Player’s hitbox bigger to get it to work which is annoying for everything else

might try decreasing the friction value of your player. It sticks to walls in unity if you dont.

Tried this, it did not work

What shape is your collider? If it’s a box, perfectly flat colliders result in infinite contact which makes friction stick you to walls. Try editing it to be slightly angled.

Screenshot 2024-03-13 10.54.43 AM
It has that extra corner in the front because she bends forward in her walking animation

According to the descriptions, maybe you should use an impulse for the jump. But, the condition about the “Jump” point is hard to understand so I don’t know. What is sure is that you should replace this condition by something else.

I normally use raycasts to check if player is on ground

That worked to fix the jump, thank you!

I don’t know about your player sticking to walls. I have a physics-based character too and mine works fine. As for your player getting stuck on ledges, that’s a byproduct of getting stuck to walls. Fix that and you fix everything.

Did you ever set the friction to 0? That’s what I have. I remove all friction and I just increase the linear damping when the player is on the ground. I think I have 0.1 linear damping in the air and 4 on the ground.

I did try that, But it has the drawback of the player not stopping when walking on the ground
I found a different solution, however.
Instead of having the game check if a point is not in an object (Because that’s buggy and doesn’t work) I have it check if a point is in an object, and then apply a force equal and opposite to the player’s movement speed

If the player doesn’t stop on the ground, just increase the drag while on the ground. This is the tried and true method of doing this.