Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by THEAK472009 · Aug 23, 2014 at 12:02 AM · physics2dboxcollider2dcircle

Optimization (2D) - Box Collider vs Circle Collider

Hello, I am almost done with developing a mobile game. Now it's time for optimization. There are a lot of places where I have used 2D Box Colliders but is it true that Circle Collider is more optimized?

Thank You

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

2 Replies

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

Answer by GarBenjamin · Aug 23, 2014 at 02:19 AM

According to this post it is:

http://forum.unity3d.com/threads/capsule-vs-box-colliders.34254/

Fastest to slowest...

capsule sphere box

Personally, I don't understand that. In my mind nothing should be faster than a simple overlapping rectangle (or cube) collision checking routine. But the test results definitely show box as being the slowest. Maybe it is something the graphics card itself can do these days.

Anyway, I doubt it would be worth the effort converting your entire game to use sphere colliders. Considering rectangles and cubes are the slowest method this aspect should be very fast in all cases. I think the biggest gains for collision checking would come from simply layering your objects and only allowing certain sets of objects to collide with other sets (enemies likely would not collide with other enemies or with powerups and so forth).

Comment
Add comment · Show 4 · 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 THEAK472009 · Aug 23, 2014 at 09:51 PM 0
Share

Thanks! Appreciate it.

avatar image TimB · Jun 19, 2015 at 04:09 PM 1
Share

I think you meant: sphere, capsule, box

avatar image ArtOfWarfare · Dec 04, 2015 at 12:59 AM 2
Share

I would imagine the thing you may not be considering is the possibility that the boxes have different rotations. I believe that makes the check a good deal more difficult than a check where you can assume that the edges are parallel with the axes.

avatar image Casiell · Oct 04, 2018 at 08:38 AM 0
Share

Why would anything be faster than circle/sphere? The only thing to check if centers of those colliders are closer than sum of their radiuses.

For square/cube there is a lot more going on and they are rotation dependant unlike sphere/circle

avatar image
0

Answer by juanitogan · Oct 04, 2018 at 08:32 AM

An answer specific to the 2D world can be found here (spoiler: circle is fastest):

https://stackoverflow.com/a/42029708/680464

Info on CapsuleCollider2D, however, is not included and I would be interested to see if it still outperforms box in the 2D engine (since it is now competing against a 4-corner box instead of an 8-corner box). No info on edgeRadius either (which, basically, on a box, turns a box into a capsule stretched two ways).

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

26 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

Related Questions

Is Physics2D BoxCast accuracy influenced by tranform.scale ? 0 Answers

Platformer2D Player sticks to platform corners 0 Answers

Inaccurency BoxCast2D,Inaccuracy BoxCast2D 0 Answers

Rigidbody2D is kind of flying instead of falling when the child box is colliding 1 Answer

Some BoxCollider2D don't get hitted by no apparent reason 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