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

Player get stuck onTriggerEnter platform

Discussion in '2D' started by JanFuri, Mar 3, 2022.

  1. JanFuri

    JanFuri

    Joined:
    Jan 23, 2022
    Posts:
    6
    Hi, I using custom Physic2D (from some unity streaming) and if my player trigger or collide with moving platform hes get stuck on it, moving or jumping is disabled.

    So If player trigger collider on platform hes become child object of platform, but hes get stuck there , everything was fine until i used new Physic2D (by following tutorial from unity)

    Pls can you help me?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,622
    Not really. You've only provided some vague description that isn't clear. "custom Physic2D" could mean anything. What is "unity streaming"? What's a "onTriggerEnter platform"?

    If you're completely new to Unity and using C# then likely the forums are not the place to resolve that whereas places like Unity Learn is which has a whole lot of tutorials.
     
  3. JanFuri

    JanFuri

    Joined:
    Jan 23, 2022
    Posts:
    6
    Yes, it's unclear i apologize.

    source: https://learn.unity.com/tutorial/live-session-2d-platformer-character-controller

    In my game I am using Event System which moving with platform to upside and downside on call OnTriggerExit2d.
    If i jump with my character on moving platform (OnTriggerEnter2d), platform move to side by Vector2.Lerp and character become child object of platform (so he can stay on it) and get stuck directly on that (BoxCollider with Trigger).

    Thank you
     
  4. JanFuri

    JanFuri

    Joined:
    Jan 23, 2022
    Posts:
    6
    I tried:
    add function to gameObject with trigger: grounded = true ( character is on ground)
    I tried create new layer and ignore raycast between gameObject with trigger and character.
    nothing works
    I really appreciate your time and thank you for any answer
     
    Last edited: Mar 4, 2022
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,622
    So any stuck is your code. If it's a trigger then the physics engine doesn't produce any contacts or collision response. It's still not clear what you're doing.

    It's impossible to fix something without understanding the code or the problem in the first place unfortunately.
     
  6. JanFuri

    JanFuri

    Joined:
    Jan 23, 2022
    Posts:
    6