Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    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. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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.