Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Seeking best practices for using a PlatformEffector2D

Discussion in '2D' started by Reverend-Speed, Mar 25, 2023.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    I'm looking for advice on the best way to make one way platforms for a 2D game.

    I'm using a platform effector, but if I make a platform out of multiple game objects, then the character gets stuck on the colliders of the component game objects of the platform.

    If I use a separate tile map for platforms, the CompositeCollider2D handles getting stuck on multiple platforms - but it can lead to problems where I find myself 'entering' adjacent walls if I'm standing in front of a one-way platform...!

    Does anybody have a best-practice take on making these platforms?

    If I walk any further left in this situation, I get quickly teleported into the left wall.
     
  2. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Seem to have solved this problem by setting the Geometry Type to 'Polygons' on the CompositeCollider2D of my TilemapMidground (generic terrain) and TilemapOneWayPlatforms (one-way platforms) gameobjects. This prevents the character from being shoved inside the wall geometry on contact.