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 hassanyawar · Sep 15, 2021 at 09:37 PM · colliderperformanceperformance optimizationcompound collider

Large number static colliders performance impact in a scene?

Hi,

I have a question related to static colliders. I'm creating a big city in the scene where different building prefabs will be spawned. Now some buildings have a little complex geometry due to which I decided to use multiple box colliders as children of the building's gameobject. These colliders can go up to 20 to 25 static colliders per building.

My other option was to use mesh collider with convex checked but the convex colliders formed created some bad playing experience, for example, my character being blocked some distance away from the wall.

I also put these building colliders in a specific layer and removed their collision with each other in collision matrix as I need these colliders only to collide with player.

So imagine a city having roughly around 1000 static colliders in the scene. How badly will it affect the performance? By the way, target platform is windows and macOS standalone.

I apologise if this question has been asked before.

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
1
Best Answer

Answer by FlaSh-G · Sep 15, 2021 at 09:53 PM

First off: You don't need to disable collision between colliders that don't have a Rigidbody. Colliders are completely passive and don't care about collisions at all. It's Rigidbodies, CharacterControllers and Physics methods (like Raycasts) that look at colliders for collisions.

Next, physics engines have acceleration structures. They are data structures that create spatial partitions for your colliders. See, 2D and 3D space don't actually exist in your computer. There's just a pile of objects (like colliders) with numbers on them to define their position and shape in the virtual space. A Rigidbody that moves through the scene has to go through these colliders and check whether it intersects one of them with its own colliders. The acceleration structure allows the Rigidbody to only check the part of the scene it's actually in and ignore all colliders that are somewhere else. The Rigidbody will ask the physics engine for collision candidates and then checks the very small amount of colliders that are returned, one by one. This comes at an increased cost when moving colliders - when a collider's position changes, it might move into a different partition of the scene, so that needs to be checked. Since your colliders are marked as static, they never move and this cost is basically gone.

That being said, literally nothing comes at no cost at all. So while having quite a few colliders is not as bad an idea as one might think, the best thing you can do it try and do some profiling to see how well the machine can handle it.

Comment
Add comment · Show 1 · 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 hassanyawar · Sep 20, 2021 at 12:37 PM 0
Share

I never got the opportunity to thank you for your response. Your explanation is really helpful. I setup static compound colliders on the buildings in the scene. So far I haven't faced any performance problem but as you said I will profile it much detail.

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

182 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 avatar image avatar image

Related Questions

Hundreds of box colliders or 1 big mesh collider 1 Answer

Raycaste vs trigger Colliders & Rigidbody performance 1 Answer

Random Performance Spikes due to Physics.Processing in a static scene. 1 Answer

Optimizing Performance with tris 0 Answers

Performance hiccup on initial contact with rigid bodies 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