Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. 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

    FreeHugsHere

    Joined:
    Apr 7, 2015
    Posts:
    9
    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?
    Thanks.
     
  2. MelvMay

    MelvMay

    Unity Technologies

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