#Collision Detection 2D Platformer Issue

1 messages · Page 1 of 1 (latest)

frozen slate
#

I'm making a 2D character controller for a platformer.
I stopped using collision checks via ShapeCast or RayCast in favor of Physics2D.IsTouching(), so I wouldn’t desynchronize the Rigidbody physics system and my collision-check components.
Everything works fine, except for one case.

I have three platforms. I’m not using a TileMap, so I put them manually using coordinates.
The two side platforms are regular static Rigidbodies.
The middle platform is a OneWayPlatform that has logic for enabling/disabling collision ignoring.

I discovered that sometimes, when the character walks over the seam between colliders, the character stops. My debug component shows that a wall collision is being registered. When I inspected the scene closely, I found the exact point where it happens.
My assumption is: when the physics engine tries to calculate the AABB intersection, it catches a tiny part of the collider right at the seam, producing a normal that points to the right. My collision detector thinks the character has hit a wall. The same issue appears on the right side as well.

I thought about using a CompositeCollider, but that would break the OneWayPlatform logic.

Question: what is the best way to handle this moment?
The current collision-checking logic seems fine, but the fact that a side normal is being detected at the seam is a bit strange.
Do you have any suggestions?
I don't want to use Raycasts or Shapecasts*

#

Collision Detection 2D Platformer Issue

feral delta
#

Did you get any good solutions? I'm curious too.