Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

2D Collider Transform for Sliding

Discussion in '2D' started by RoyalCoder, Sep 24, 2014.

  1. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi guys, I'm working on a 2D game ... what I'm trying to achieve is when the character have in front an object (platform in my case) to be able to sliding underneath not to collide with it, like in my graphic here:

    How can I Transform the collider position when the character is sliding ? Any ideas ?
     
  2. SpacemanBoots

    SpacemanBoots

    Joined:
    Nov 27, 2012
    Posts:
    32
    Why not simply switch to a different collider?
     
  3. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi SpacemanBoots, how exactly to do that...can you be more explicite ?
     
  4. SpacemanBoots

    SpacemanBoots

    Joined:
    Nov 27, 2012
    Posts:
    32
    Put 2 colliders on an object. One that's shaped to your character standing straight. And the other shaped to your character sliding.

    So when your character is in his "Standing" state, you disable the sliding collider and enable the standing straight collider.
    And when you character is in his "Sliding" state, you do the opposite.
     

    Attached Files:

    KimberlyAnne and Mo_Zarara like this.