Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by malkere · Jun 11, 2017 at 02:06 AM · physicscollidersmeshcollideroverlap

Physics.OverlapBox colliding with disabled MeshCollider

I'm using this:

         Collider[] cols = Physics.OverlapBox(worldPos, new Vector3(1.39f, 1.39f, 1.39f), Quaternion.identity, BuildingData.buildingMask);

to look at an area. It always works and has for days, but I've found that if I have a disabled MeshCollider on one of my walls (built using ProBuilder) it triggers the OverlapBox even though the collider is off. This is of course undesirable, and is why I turn the collider off in those cases (dummy wall that gets moved around before placement, half-transparent, all colliders disabled).

If I remove the MeshCollider completely it stops throwing the error even though there is a BoxCollider the exact same dimensions/position that never hits while disabled.

Logically I want to assume it's something wrong with the way ProBuilder is handling the collider, but it shouldn't matter when it's clearly disabled... should it?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hexagonius · Jun 11, 2017 at 06:44 AM 0
Share

You are right, it shouldn't matter. All Pro Builder does is generating a bunch of vertices that form a mesh. The physics engine is only told to use it. Have you tried logging the enabled state after you detect the overlap? I bet it's enabled.

avatar image malkere · Jun 11, 2017 at 11:00 AM 0
Share

I use pause on error so I'm just looking at the object when the error is thrown. Hmm... I will try it anyway, maybe it's being turned off simultaneously.. There's a chance it's being brought in and turned off in the same frame the check it happening. I have seven or eight other objects all with colliders being turned off in the same manner though that have never caused problems. Just this one $$anonymous$$eshCollider...

avatar image malkere · Jun 11, 2017 at 11:13 AM 0
Share

I'm getting a False return from Debug.Log(cols[0].Enabled.ToString()); There's no way that's correct. The line after the collider is taken in for the precise reason of being collided with it then reports itself as disabled. Can't seem to reproduce it of course... and I worked around it by removing the collider so it's not hindering me anymore... still certainly not "working" behavior

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by $$anonymous$$ · Dec 04, 2019 at 08:55 AM

i think Physics.OverlapBox doesn't get the mesh collider because it doesn't "exist". make the mesh collider always active and set it to "IsTrigger" and in the Physics.OverlapBox set the Query Trigger Interaction to QueryTriggerInteraction.Collide.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

104 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is "Physics Mesh" and Do I Need Them If Not Using Mesh Colliders? 0 Answers

Translating an object along a line until it collides with other objects 1 Answer

Physics artifacts on terrain seams 0 Answers

Player collides with open doorway? 1 Answer

(Light enabled colliders) given a surface, how to make a collider such that only the portions of the surface in contact with a light source are activated?(Game example included) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges