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 ivanisavich · Jun 20, 2011 at 09:05 PM · rigidbodyperformancelagkinematic

Can you move a rigidbody without causing it to activate?

I'm trying to move a bunch of kinematic rigidbodies around (they also each have a collider attached). However, each time I move one, I see a drop in performance in the profiler. When not moved, the profiler says there are no active rigidbodies. However, as soon as I move one (or a group of them) it/they become active and there's a performance drop.

All I want to do is shift their position over 1 frame. They don't need to collide or interact with anything in the process. How do I do this without them activating and causing a drop in performance?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by flaviusxvii · Jun 20, 2011 at 09:21 PM

Moving such things causes PhysX (the underlying physics engine) to rebuild it's broad-phase collision detection trees. It doesn't matter if they aren't colliding.

Comment
Add comment · Show 17 · 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 ivanisavich · Jun 20, 2011 at 10:03 PM 0
Share

Sooo....is there a workaround?

avatar image flaviusxvii · Jun 20, 2011 at 10:08 PM 0
Share

Hard to tell without knowing more details of what you're trying to accomplish with them.

avatar image ivanisavich · Jun 20, 2011 at 10:16 PM 0
Share

Well, it's as simple as the original description. I have a bunch of kinematic rigidbody colliders, and I just need to reposition them without taking a physics hit. They won't be colliding with anything during the move.

Does using rigidbody.moveposition work faster than accessing transform.position directly?

avatar image ivanisavich · Jun 20, 2011 at 10:21 PM 0
Share

Hmm...it seems as though having the rigidbody on an empty gameobject, and then having the collider parented to that rigidbody.....and then moving the collider object while the rigidbody parent stays stationary doesn't activate the physics engine. I'll do some more tests, but that might be the solution I'm looking for!

avatar image flaviusxvii · Jun 20, 2011 at 10:27 PM 0
Share

"I have a bunch of kinematic rigidbody colliders"

Yeah, I read what you wrote, and this is a solution you've come up with, but what are you using them for? You might be going about it all wrong for all I know. I can't tell you what to do without knowing what your use case is. Teleporting rigidbodies is quite unnatural.

Show more comments
avatar image
0

Answer by _Petroz · Jun 21, 2011 at 02:09 AM

Try putting the RigidBody to sleep before you move it.

http://unity3d.com/support/documentation/ScriptReference/Rigidbody.Sleep.html

Rigidbodies can also be forced to sleep using rigidbody.Sleep. This is useful to start rigidbodies in a rest state when loading a new level.

Taken from http://unity3d.com/support/documentation/Components/RigidbodySleeping.html

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 flaviusxvii · Jun 21, 2011 at 04:18 AM 0
Share

Unfortunately this won't prevent a potentially drastic rebuild of the physics broadphase. I actually have fairly intimate knowledge of PhysX so I am pretty sure this is the case.

avatar image
0

Answer by testure · Jun 21, 2011 at 05:17 AM

You could destroy your rigid body when you don't need it, and then add it back when you need it again.

 Destroy(rigidbody);

and when you need it back:

 gameObject.AddComponent(Rigidbody);
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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Are my kinematic rigidbodies slowing my scene down? 2 Answers

Problem With Kinematic Children 1 Answer

Possible to Give Rigid bodies collision bounding boxes? 0 Answers

How do I grab an object without going through it? 0 Answers

Adding rigidbodies to enemies is lagging out the game? 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