Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 sparkzbarca · Oct 29, 2012 at 10:33 AM · mesh colliderprimitive colliders

Question regarding mesh collider vs primitives

Am I correct in thinking that mesh colliders are inherently less efficient than primitives by nature? Specifically if I took a box and placed a box collider on it would it be faster at resolving collisions than making a Mesh collider for the box even though the mesh collider is of course a box shape.

It appears it would be faster because the box collider does a distance bounds check and basically is alot faster because it gets to make assumptions because it knows its dealing with a box (AKA the width, height and depth are all equal)

I'm asking because i'd like to include a triangle in my game to allow people to edit with, the thing is a triangle isn't really a combination of any other shape or shapes.

Now its only 6 vertices so i'm not sure it matters even if i had several thousand floating around but it might, I know the fact that it is only 6 vertices helps it as a mesh even if it's not as fast as a box but i'd like some input from someone with more knowledge.

is a box or sphere collider faster than a box or sphere mesh collider and is there an easy way to deal with triangles using primitives or should i just use a mesh or what?

Comment
Add comment · Show 1
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 Fattie · Oct 29, 2012 at 10:35 AM 0
Share

you've completely hit the nail on the head -- basically you DONT USE mesh colliders, ever, in video games. maybe for ground surfaces that are not flat.

this is exactly what it means to "make video games"

this question comes up all the time .. eg 5 $$anonymous$$s ago :)

http://answers.unity3d.com/questions/339406/how-to-approach-making-a-large-city-map.html

"yes, montray is right. You have to carefully create all the colliders -- that means box colliders and sphere colliders -- for a video game. It's how they are built!

$$anonymous$$esh colliders are rarely used for anything - "the ground" (if it's not flat) is about the only exception really.

typically your art department will give you an amazing city or whatever, and then the poor engineers spend weeks carefully making beautiful colliders that reasonably work with it, efficiently"

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Owen-Reynolds · Oct 29, 2012 at 02:35 PM

Could just make a quick script to randomly spawn 1000 falling objects, swapping between box colliders and your triangle mesh ones.

But, some of the theory: the game engine does very fast, crude collision tests before even looking at the exact shape of your collider. Something like an Oct-tree groups the map into general areas, and skips collision testing for objects in different areas. This is why the frame-rate drops when you pile more objects together.

Objects have an axis-aligned bounding box (a big box with rotation 0,0,0, covering everything.) It's very fast to check "if your left side is past my right side" to rule out collisions.

When you finally get to the "real" collision test, sure, official boxes are probably faster. It might run only 6 checks for a Box collider, whereas 8 checks (1 per tri) on your 3D triangle mesh collider. Box colliders might "know" that checking the skinniest axis first will rule things out faster.

Comment
Add comment · Show 2 · 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 sparkzbarca · Oct 29, 2012 at 07:12 PM 0
Share

from the sounds of it a mesh collider triangle is still faster then than say 2 primitive boxes trying to do there best to encompass the shape and since boxes are the fastest primitives 2 boxes is the fastest compound shape. Since i want the triangles to be shot i need the collision detections to be a fairly accurate representation of the shape.

As such I think a mesh triangle is probably best since 8 tri check is still better than say 2 boxes each with a 6 side check.

Thanks for your answer!!

avatar image jimjames · Dec 16, 2015 at 06:59 PM 0
Share

Really well answered question. I was wondering if you could take a look at my question on this matter and give me your input?

Link: http://answers.unity3d.com/questions/1113484/primitive-colliders-vs-mesh-colliders.html

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

11 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

Related Questions

Mesh collider and Terrain collider 0 Answers

Generating a convex hull 3 Answers

Mesh Collider to a character and the maze? 3 Answers

How do i find the top of a mesh? 3 Answers

Procedural Generated mesh collider creates invisible walls after the first iteration 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