Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Collision glitch?

Discussion in 'Physics' started by FreeHugsHere, May 13, 2018.

  1. FreeHugsHere


    Apr 7, 2015
    Im trying to do that my player can go behind the object and in front of it. The script i wrote is working and the render is working correct too, but in some point when the player come very close to the object collision in a dense and still walking, and after immediately go behind the object, render shows that the player is on the front of object.
    However if i don't touch this collision on the bottom of the object, everything work fine. I double checked the script, and its seems the problem because of the collision.
    Layers is in the right orders.

    The character have rigid body2d, collider 2d, and the child object with the script that helps to sort layers have also collider 2d.
    Object(The Stone) have polygon collider 2d and the child - box collider 2d which i assume is cause this glitch, but i need it also so player can't go through the object, so it looks not like i want.

    Any ideas how to fix it?
  2. MelvMay


    Unity Technologies

    May 24, 2013
    It has to be in the logic of your script (perhaps in a collision callback), collision has no impact on rendering.