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 andyisbonza · Oct 13, 2015 at 06:39 AM · colliderscollision detectionperformance optimizationkinematicrigidbody-collision

Kinematic rigidbodies, colliders and performance

Hello all, I am trying to get clarification on a question I asked some time ago about colliders and performance. I got some different answers the first time around that seemed to conflict with each other (that might be because I didn't explain things well).

My game consists of a bunch of objects that are constantly moving. The background graphics are all hittable and they are constantly moving from right to left. I'm not using any physics - just directly manipulating the positions of transforms. Because there is no physics, I use kinematic rigidbodies for collision detection.

When I originally asked about colliders, I was told that I don't need rigidbodies on both objects that would collide - only on one of them. So I removed a bunch of rigidbodies, and now, only my bullet objects have kinematic rigidbodies. So for example, when a bullet hits a background, I have:

  • moving bullet: collider with kinematic rigidbody

  • moving background: collider only (turning it into a static collider)

My question is: would this not create a performance hit? The documentation states: "In general, you should not reposition static colliders by changing the Transform position since this will impact heavily on the performance of the physics engine".

The backgrounds don't need to move as a result of the collision - they are always moving regardless of whether or not they have been hit with a bullet.

So I am confused - I removed rigidbodies, but do I need to re-add them?

My original post is here: http://answers.unity3d.com/questions/512467/are-my-kinematic-rigidbodies-slowing-my-scene-down.html

Many thanks in advance for all answers and insights!

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
0

Answer by Halfbiscuit · Oct 13, 2015 at 09:02 AM

I believe when it says static colliders it means objects with colliders and the static variable ticked. Moving an object when it is marked as static means the physics has to redo some calculations.

Moving a collider when the object is not marked as static should not impact performance.

Edit: Seems I was wrong (static variable has no relevance to physics) and according to this answer moving a collider without a rigid body can cause a performance hit.

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 andyisbonza · Oct 13, 2015 at 09:07 AM 0
Share

Thanks for the reply. I'm not sure what you mean by the "static variable" though?

Unity doco defines a static collider in this way:

Colliders can be added to an object without a Rigidbody component to create floors, walls and other motionless elements of a scene. These are referred to as static colliders

avatar image Halfbiscuit andyisbonza · Oct 13, 2015 at 09:21 AM 0
Share

Staric GameObject doc.

The static setting is in the top right in the inspector.

avatar image andyisbonza Halfbiscuit · Oct 13, 2015 at 10:22 AM 0
Share

Looking at that link, it doesn't look like setting an object as static impacts collisions or physics - more to do with rendering, lighting, navigation, etc. In any case, none of my objects are non-moving, and none of them are ticked as static.

Show more comments

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

30 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

Related Questions

How can I simulate a realistic collision between a metal axe and a door and prevent them from passing through each other? 1 Answer

Will disabeling a static collider have the same performance hit as moving it? 1 Answer

How to check if 2 collisions are on the same objects ? (is player on the same ground than enemy?) 2 Answers

Complex collision layers 1 Answer

Gameobject not detecting collison from other Box Collider 2D [SOLVED?] 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