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
1
Question by madfatcat · Oct 16, 2019 at 04:11 PM · collisioncollidersphysics2dcollider2d2d-physics

CircleCollider2D vs PolygonCollider2D: which collision solving is less expensive?

Say I have a gameobject with Rigidbody2D and X circle colliders. Other gameobject also has Rigidbody2D and PolygonCollider2D with 2X points. Which of two gameobjects is less expensive in terms of CPU usage when solving collisions?

Comment
Add comment · Show 4
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 · Oct 17, 2019 at 08:09 AM 0
Share

Circle tests are always the most performant, no matter what. It's a simple distance between centers vs. the sum of their radii comparison

avatar image madfatcat hexagonius · Oct 18, 2019 at 09:24 AM 0
Share

Let me please just repeat my question: Which of two gameobjects is less expensive?

avatar image Bonfire-Boy hexagonius · Oct 18, 2019 at 09:37 AM 1
Share

@hexagonius I think the question is a bit more involved than just a comparison of individual colliders' performance.

It's multiple circles vs a single polygon. From the X vs 2X, I'm guessing they've got a polygon and are wanting to decide between
a) a single polygon collider,
and
b) circle colliders at each vertex and halfway along each edge.

On reflection - the X and 2X are the wrong way round for that. @madfatcat what is your actual use case?

avatar image RadonRaph · Oct 18, 2019 at 10:23 AM 0
Share

Your case is very specific you could just monitor the difference in the profiler ?

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by hexagonius · Oct 18, 2019 at 10:26 AM

The fact that we do not know how the collision solving is implemented and we also do not know your X, we can't say anything about this. The other fact is that the question is odd. You can only solve a collision between two GameObjects, otherwise there is no collision to solve, so it's not possible to split the cost between the two.
What you could to is setup a solver scenario, duplicate this a couple of hundred times and see what the profiler spits out during the solving frame. Do the same with a change in object count. I wouldn't be surprised if factors like "on which side of a polygon collider does the collision occur" or "is it convex or concave" would also matter.
From my experience, questions like "which does cost more performance" can almost never be answered without profiling them, which is why I initially answered with the rule of thumb of circle collisions being the least expensive.

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

180 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 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

Problem with method Collider2D.isTouchingLayers() 4 Answers

Tilemap Collider 2D preventing objects from moving 2 Answers

Static Colliders in the 2D Engine in Unity 5 1 Answer

Physics2D.OverlapCircle dont detect triggers 3 Answers

Help needed making fake 3D collision in a beat em up style 2D project 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