Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Detecting collisions with no physics response at all

Discussion in 'Editor & General Support' started by manuelflara, Oct 31, 2007.

  1. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    I think this wasn't possible prior to 2.0 (being able to get a callback called when two colliders collided with no response at all from them, just penetrated each other), but as there have been some improvements to the physics system/ageia wrapper, I wonder if this can be done. I hope so, it could be very useful for puzzle games and so.
     
  2. Omar Rojo

    Omar Rojo

    Joined:
    Jan 4, 2007
    Posts:
    494
    Do you want.. triggers ?

    .ORG
     
  3. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Not exactly, because triggers are "triggered" (callback is called) when a rigibody collides with it, not other triggers. So if I have a number of moving entities and I want all of them to not use physics (like, be triggers and not rigidbodies), I can't just make them all triggers. They don't work as I'd want.
     
  4. Bampf

    Bampf

    Joined:
    Oct 21, 2005
    Posts:
    369
  5. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    AFAIK, I also tried that, and kinematic rigidbodies didn't report their collisions between them.

    I mean, you get a collision callback when a non kinematic rigidbody is involved (with any trigger or kinematic rigidbody).
     
  6. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
  7. Bampf

    Bampf

    Joined:
    Oct 21, 2005
    Posts:
    369
    I had a similar problem once and it was actually because mesh-to-mesh collisions were not supported at the time. According to the docs that David just posted, you can do mesh-to-mesh now (requires Unity 2, I'm assuming) provided the collider meshes have a small number of triangles and are marked Convex.

    In my game I switched from mesh colliders to primitives, easy for me because my objects were mostly cylindrical.

    I'll also add that for certain puzzle games it might actually be better to resolve "collisions" differently than using Unity's collision detection. I say this because if the frame rate isn't keeping up it can change the results of the puzzle. My puzzle game had a fast-forward button, and on slow machines the puzzle wouldn't play back properly because objects would pass through each other.

    In my case there were some failsafe's I could add to detect when it happened, but it was a frustrating problem. Other solutions might have included not relying on collision detection at all, or rolling my own collision tests that project objects along their path of movement to detect collisions that otherwise would have been passed over. Or improving the frame rate somehow, or just raising the minimum supported system requirements... If your objects aren't moving more than a fraction of their own width/height per frame then it's probably not a problem.