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
0
Question by vsemenyakin · Mar 30, 2019 at 02:07 PM · collisionphysicsrigidbodyrigidbody2dphysics2d

Is it possible to disable collisions for separate physics scene?

In my game I use separate scene with physics to simulate future Rigid Body state for Game Objects in main scene. It is useful for AI logic & player projectiles shooting predictions. Simulation scene was intended to be very simple, without any collisions processing, just as physics calculator to get future Rigid Body state for each Game Object that needs it. But, unfortunately, I discovered that over 150 steps of simulation per frame causes significant performance problems. FPS decrees up to 5 frames per second even if I simulate future of just one body per frame. So now I try to optimise. I desided to start from disabling collisions.
.
In this question Physics.IgnoreCollision method was adviced to disable collisions for object. But, as I understand, IgnoreCollision won't give any optimization, this is just additional post-collisions filter.
.
So, the question is - is there any way to disable collisions for specified scene at all?

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 Magso · Mar 30, 2019 at 09:19 PM 0
Share

Do you mean to stop all additive scene colliders colliding with other objects in the initial scene? Physics.IgnoreCollision will work but the physics engine is still calculating all the rigidbodies.

avatar image vsemenyakin Magso · Mar 30, 2019 at 09:38 PM 0
Share

I mean disabling any collisions at scene at all, to prevent physics from for$$anonymous$$g, management and updating of any spacial data structures. Signature of Physics.IgnoreCollision(...) sais "ignore collisions just between two objects" that means that ignored by each other colliders still interact with all other possible colliders at scene and, so, needed to be stored in some spacial data structure.

avatar image vsemenyakin Magso · Mar 30, 2019 at 10:28 PM 0
Share

Actually, I created a small test project to investigate performance issues. Initially scene contains one objects that is simulated 250 steps each FixedUpdate. Rigid body is influenced by constant gravitiy force each step and may be pushed by impulse at start or in some times upon simulation steps. Created test scene shows good performance - 70-80 FPS when simulating 250 steps (simulation in game shows 5-10 FPS on same steps count). So, possibly, problem is not related with physics. If so, I'll put here real cause of performance issues as question answer.

avatar image Magso vsemenyakin · Mar 31, 2019 at 05:24 PM 1
Share

To stop all physics and collisions you can use

 GetComponent<Rigidbody>().is$$anonymous$$inematic = true
 GetComponent<Collider>().enabled = false

Have you checked the profiler to find whats causing the low fps problem?

0 Replies

· Add your reply
  • Sort: 

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

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

Recalculating collisions after Physics2D.IgnoreLayerCollision()? 1 Answer

Unity Physics Collision Execution Order Error? 1 Answer

increasing knockback of a rigidbody as received damage increases (like super smash) 1 Answer

Rigidbody2D: Follow other Rigidbody2D strictly 1 Answer

Reset Rigidbody2D rotation after collision 2 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