Search Unity

Platformer 2D Animation with collider changes

Discussion in '2D' started by DamKay, Sep 23, 2019.

  1. DamKay

    DamKay

    Joined:
    Aug 18, 2019
    Posts:
    10
    I have encountered a problem that i do not know what i should do,
    When the player jumps, his legs bend in the animation and so does the collider,
    however when he lands the collider stretches downwards and into the ground.
    1. How should i make the player move up when this happens?
    2. Is it possible to format the new position based on the collider's size and offset with the current transform position?

    Btw, i use custom controller with raycasts not rigidbody

    Things that i found:
    - There is a class (SceneLinkedSMB) in the Unity 2D game kit that overrides the monobehavior, and enables you to create a script and attach it to the animation in the animator and reference efficiently the player to get information and activate functions.
    - In the same project (2D game kit) the scenario happens and it resolves on what i understood as a function that
    calculates the new position by the current collider offset and size, but i didn't quite figure how on what its based to adapt it into my project.

    Please someone actually help