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. Dismiss Notice

How to check contact between two game objects

Discussion in 'Scripting' started by kalahario, Jul 15, 2017.

  1. kalahario

    kalahario

    Joined:
    Jun 13, 2017
    Posts:
    31
    I want to check contact between one game object (ObjA which has a box collider and a rigid body) and another game object (ObjB) which has two child game objects. The child objects of ObjB change positions slightly. I haven't set a box collider for ObjB because I don't need it to react to physics, I just need to tell when one object (ObjA) is in contact/touches it. How can this be done?
     
  2. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
  3. guillermoi

    guillermoi

    Joined:
    Sep 20, 2012
    Posts:
    27
    You will need colliders on the children, probably with the "trigger" parameter set.

    Check the table at the bottom:

    https
    ://docs.unity3d.com/Manual/CollidersOverview.html