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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

2D Platformer - Platform Jumping

Discussion in '2D' started by zotey, Jul 16, 2015.

  1. zotey

    zotey

    Joined:
    Nov 14, 2012
    Posts:
    26
    Hey,

    I'm making a 2D platform/running game.
    My question is what's the best way to make the character behave like I want to?
    The character is supposed to be able to jump from beneath the platform on the platform so it goes trough the platform. But when the character is jumping down and falls on top of the platform it stil needs to be able to walk it.
    I have tried to do this with the OnTriggerExtit method, but this worked only for 50%.
    Can anyone help me out please?

    Zotey

    TEST0023.png
     
  2. Zk

    Zk

    Joined:
    May 25, 2013
    Posts:
    19
    There's actually an integrated feature for this called Platform Effector 2D - http://docs.unity3d.com/Manual/class-PlatformEffector2D.html.

    This should do exactly what you're trying to do. There's a video tutorial that discusses it as well here - https://unity3d.com/learn/tutorials/modules/beginner/5-tutorials/surface-and-platform-effector-2d

    I had the same issue and it was hard to find a solution by searching because lots of people were solving this manually before the Platform Effector 2D was added to Unity. But this pretty much just gives you a one way platform just like you're looking for with default settings.
     
    malialis, itzclay36 and zotey like this.
  3. zotey

    zotey

    Joined:
    Nov 14, 2012
    Posts:
    26
    Thank you this is exactly what i was looking for!
     
  4. itzclay36

    itzclay36

    Joined:
    Apr 11, 2015
    Posts:
    25
    Wow, wish I had known this a month ago.
     
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Gotta keep up with those release notes. :) It came out when Unity 5.0 was released, well over a month ago.