Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    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

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    68
    upload_2018-8-6_21-16-10.png
    • 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.
    FYI:
    • 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

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,145
    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

    nobluff67

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