Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Allow two rigidbodys crossing

Discussion in '2D' started by Dustin2711, Feb 18, 2020.

  1. Dustin2711

    Dustin2711

    Joined:
    Apr 12, 2018
    Posts:
    8
    Hi guys,
    I have several asteroids merging on collision. The collision is recognized by using a rigibody, a polygon collider and the OnCollisionEnter2D/OnCollisionStay2D mechanic. Everything works except the two asteroids WANT TO STOP ON CONTACT. Like you can see in the image in frame 4 and 5, the asteroids stopped progress. How can I make the two asteroids cross (as they were on 2 layers) with keeping my "OnCollisionEnter2D"?
    (Rigidbody material has bounciness 0.)
     

    Attached Files:

  2. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    Edit mesh collider so inside of image rather than right on edge?
     
  3. Dustin2711

    Dustin2711

    Joined:
    Apr 12, 2018
    Posts:
    8
    I actually need the collision from the beginning (in order to spawn an explosion).
     
  4. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    is not easy fix, u sure player will notice?
     
  5. Dustin2711

    Dustin2711

    Joined:
    Apr 12, 2018
    Posts:
    8
    I may do a workaround for now but later I surely need them to be able to cross each other.
     
  6. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    ok see if make diff to game then re-evalute
     
  7. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    Set both their Rigidbody2D body types to Kinematic and set the Rigidbody2D.useFullKinematicContacts to true. You'll get no collision response but will get callbacks. They are like triggers but with contact points. Alternately, if you're not interested in contact points then simply make them triggers.
     
    Dustin2711 likes this.
  8. Dustin2711

    Dustin2711

    Joined:
    Apr 12, 2018
    Posts:
    8
    I needed a hero and I got one. Thank you!