Search Unity

Question How can I check the collision with the black space?

Discussion in 'Scripting' started by Gold356, Feb 2, 2023.

  1. Gold356

    Gold356

    Joined:
    Mar 28, 2021
    Posts:
    19
    upload_2023-2-2_20-52-19.png

    The problem I am finding is that any collider cannot have a hole in the center with the form of the igloo. What can I do?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    Use an EdgeCollider2D, or two PolygonCollider2Ds
     
  3. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    One object can have multiple collider components on the main object, and even more collider components on children objects, and will get the "OnCollision" events from all of them.

    Make a bunch of BoxCollider2D or EdgeCollider2D that approximate the biggest parts of your object. Make an Empty as child of your object, and turn it 45º, and add more colliders on that one if that wasn't enough.