Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Child Collisions and the Effects on their Parents

Discussion in 'Scripting' started by ScatterBrain, Dec 26, 2006.

  1. ScatterBrain

    ScatterBrain

    Joined:
    Sep 23, 2006
    Posts:
    37
    Is there a way around this/anybody run into this?:
    I have a parent with a box collider and a child with a sphere collider which is larger than the parents. (both are Kinematic Rigidbody Trigger Colliders)
    When the child's colliders interact one of them receives the OnTriggerEnter() on the child, the other receives it for the parent. (and just so its mentioned, the collisions between parent and child in the same object are handled.)

    Has anyone tried two colliders on an object and found a way around this behaviour? I could drop the parent collider and simply check sqrMagnitudes on every OnTriggerStay(), but this seemed inefficient...

    Thanks,
    G
     
  2. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    What exactly are you trying to do? If you have a parent object with a rigidbody whose children have colliders but not rigidbodies, those colliders will act as a compound collider for the parent rigidbody, and not collide with eachother.
     
  3. ScatterBrain

    ScatterBrain

    Joined:
    Sep 23, 2006
    Posts:
    37
    Thanks, I didn't think about it that way. I'll have to go back to the collision grid and see how to combine these objects to get the desired affect.

    The application is a group of vehicles. I want to use triggers to make vehicles aware of other vehicles that are close by. I also want to trigger an event when they collide with each other. So I had a child with a sphere collider (radar) and a box collider around the parent waiting for a collision.
    I just get the previously unexpected behaviour of receiving a collision on the parent when only the children have collided.

    G
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    Great to know! I was actually about to start adding more (non-primitive-shaped) parts and was wondering how colliders were going to work.

    Do you know if adding these colliders would affect the center of gravity for the rigidbody, or would i have to change that manually?