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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Checking for an intersection between colliders

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

  1. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    227
    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:
    227
    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:
    227
    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.