Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

(not physics matrix related) Collider object that overlaps with non-collider object.

Discussion in 'Physics' started by nobluff67, Aug 7, 2018.

  1. nobluff67


    Nov 3, 2016
    • The red is the 3d object with a collider (The Mountain). This is one solid object that is broken up by the yellow object.
    • The yellow is the object without a collider (The tunnel)
    • The blue is the character that can move through the tunnel but not the mountain. The issue is that the tunnel intersects the mountain, so the character collides with the mountain when its partly through the tunnel. This is a character controller. I know I can solve my problem if I create my own controller using rigid body, however I am trying to avoid this.
    • The tunnel and mountain belongs to a asset that generates terrain (much more sophisticated than what is shown here), so I really dont have that much control over the creation of the tunnel or mountain. I could make changes to the code however this complicates things when there are updates. Also the code is quite lengthy.
    • The tunnel and mountain are on different layers.

    My question is:

    Is there a simple way to get the tunnel to override the mountain collider where the two intersect? Maybe some type of ordering?
  2. Edy


    Jun 3, 2010
    The yellow object is "invisible" to physics, while the red object is "solid opaque". The only way to achieve what you want with physics is splitting the red object to make a physical path between both parts. There's no way for colliders to "partially" collide with other colliders. They either collide or not.

    The Physics Debugger may help you to better understand how things are seen from the physics side:
    • Window > Physics Debugger
    • Enable "Collision Geometry" in the small bottom-right window in the Scene view.
    • Recommended: choose "Wireframe" as shading mode in the Scene view.
    What you see then is the "physical" world. If you want some solid objects (green) to have tunnels inside them, you'll have to model their collider including the tunnel geometry explicitly, so other colliders will collide with the other parts of the mountain, but will be able to pass through the tunnel.
    nobluff67 likes this.
  3. nobluff67


    Nov 3, 2016
    Thanks, that's what I was worried about, no easy solution.