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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to detect if sprite is touching another sprite.

Discussion in '2D' started by Silverriolu295, Nov 12, 2014.

  1. Silverriolu295

    Silverriolu295

    Joined:
    Nov 12, 2014
    Posts:
    48
    So I'm new to unityscript and I'm working on a relatively small app. I need to test if an object is on a certain side of the screen. I made two sprites for each side. If an object touches a certain sprite, it will set a value to true. How do i do this? Please walk me through it too.
    Thanks!
     
  2. cbothra

    cbothra

    Joined:
    Mar 14, 2014
    Posts:
    125
  3. Silverriolu295

    Silverriolu295

    Joined:
    Nov 12, 2014
    Posts:
    48
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    What constitutes touching? ie if two sprites are right next to each other, but not overlapping, is that a touch?
     
  5. Silverriolu295

    Silverriolu295

    Joined:
    Nov 12, 2014
    Posts:
    48
    Like, imagine that the sprite steps on a carpet or something. That would count as a touch.