Search Unity

Problem with colliders sliding against one another in 2D ski game.

Discussion in 'Physics' started by Deleted User, Dec 18, 2018.

  1. Deleted User

    Deleted User

    Guest

    Hey there people,

    I am a first year games prog student and for this week I am making a 2D ski game in Unity. Everything seems to be working fine except for one glitch I can't find a way to get rid of: often, there occurs a collision on surfaces that are straight:



    I have set up the tilemap rigidbody2D to static, the player's rigidbody2D's collision detection to continuous but the collision glitch still occurs.
    Here are the culprits:


    (Only the capsule collider is simulated, the three square ones are triggers.)

    Note that I have already tried to use a composite collider on the tilemap collider as well as mess around with Time.fixedDeltaTime to no avail.
    I'm running out of ideas of how to fix this glitch that's fairly game breaking for a game that's all about sliding down a mountain fast...

    My best guess at the reason this glitch occurs would be that the capsule collider sinks into the ground ever so slightly when moving because of gravity up until the point where the engine realizes there is a collision and ejects the capsule collider out of the ground collider... but that doesn't explain why this glitch occurs the same way whether the gravity is set to 1 or higher, the glitch would logically occur more often with a higher gravity... So I don't know.

    If anyone has ideas on what might be causing the glitch and/or how to fix it, that would be very appreciated.