Search Unity

Checking for an intersection between colliders

Discussion in 'Scripting' started by Avo, Jan 4, 2013.

  1. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    237
    I've been working on a construction system for my game but I've been unable to find a way to check for an intersection between two objects that returns the collided objects as opposed to a Boolean. Can someone point me in the right direction? Thanks for your time!
     
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    You are checking two objects for a collision, without knowing what the two objects are?
     
  3. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    237
    I know what the first object is, it's always going to be the building template but the other collider could be almost anything, an enemy, another building or a terrain feature I've deemed unbuildable.
     
  4. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
  5. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
  6. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    237
    Sorry for me delayed response, I was trying out your suggestions here. It seems to be working well enough now, thanks for your time Goblox and Bigmisterb. OnCollisionStay was exactly what I needed.