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 /
  • Help Room /
avatar image
1
Question by EdGann · Jul 17, 2017 at 05:50 PM · collidercubeplanemeshcolliderboxcollider

Is it better to use the Plane Mesh Collider or a Box Collider for Walls and Floors.

I noticed that the Plane has a Mesh Collider and the Cube has a Box Collider. I'm wondering if a simple Plane type Mesh Collide would be as efficient or more efficient than a Box Collider for floors and one sided walls? Does anybody know?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by FortisVenaliter · Jul 17, 2017 at 07:41 PM

A box collider is calculated as a collision volume, whereas mesh colliders check their bounds first, then run a per-triangle collision (on reduced triangle meshes generated by the engine, but still). So, typically, it's better to do the box colliders.

However, if you're doing a whole level, one mesh collider is probably better than a hundred box colliders, so it's a give and take.

Comment
Add comment · Show 6 · 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
avatar image EdGann · Jul 17, 2017 at 07:44 PM 1
Share

Ok, maybe I should ask this another way. Why do they use a $$anonymous$$esh Collider on a plane ins$$anonymous$$d of a very thins box collider?

avatar image FortisVenaliter EdGann · Jul 17, 2017 at 07:59 PM 1
Share

Two reasons. One, a very thin box often ends up causing problems due to how thin it is, which could produce unexpected effects. Two, a mesh collider is normal-dependent, meaning it ignores backfaces as well, which a box collider would not. In short, a mesh collider is more appropriate.

I usually use box colliders with a thickness of at least 0.5 for ground colliders.

avatar image Bunny83 · Jul 17, 2017 at 07:50 PM 1
Share

Well summarised. Though i'd like to add that a normal $$anonymous$$eshCollider does not reduce the triangles at all. Only when you select "convex" Unity tries to calculate the convex hull of the mesh (which btw isn't always possible since the convex hull is limited to 256 triangles).

Normal $$anonymous$$eshCollider also allow you to actually deter$$anonymous$$e which triangle was hit when raycasting.

avatar image FortisVenaliter Bunny83 · Jul 17, 2017 at 08:00 PM 0
Share

Great points; definitely something to consider.

avatar image EdGann · Jul 17, 2017 at 08:48 PM 0
Share

FortisVenaliter: $$anonymous$$aybe I am a little dense, but it seems lie you said that a $$anonymous$$esh Collider would be appropriate for a floor or one sided wall, but you use a Box Collider of >.5 thickness. What am I missing?

I'm just wondering what the cost is for a simple $$anonymous$$esh Collider that is flat and made up of two triangles. I sort of think that since Unity uses a $$anonymous$$esh Collider for a plane that it is more efficient than box in this case, but that may not be true.

But if it is true, might it also be true that if you have a wall that has a thickness of say .1, and nothing would ever come in contact with the ends, top, or bottom, that two $$anonymous$$esh Colliders would be better than one Box?

avatar image FortisVenaliter EdGann · Jul 17, 2017 at 09:08 PM 0
Share

It's certainly possible. The best way to tell would be to run it both ways and check the profiler. With the complexity of modern game engines, there are few hard and fast rules, more of just guidelines you pick up with experience.

I think the disconnect is with one simple fact: The mesh collider uses triangle-based collisions, whereas the other pre-built colliders use volume-based collisions.

That means that the shape colliders never have to test against individual triangles, whereas a mesh collider will always have to loop through the triangles if there is a collision. That's what makes them inherently faster. So, if your mesh collider has fewer triangles than the total number of shape colliders, yes, it can absolutely be faster.

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

82 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

Related Questions

How can I implement box collider or mesh collider in this code? 0 Answers

Box Collider for animating characters. 0 Answers

Object do not stop after collision 0 Answers

Blender Models aren't generating mesh colliders! 0 Answers

How to fix Unity 5 Mesh Collider Convex Problems? 1 Answer


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