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
3
Question by Shadyfella13 · Feb 09, 2010 at 05:00 PM · collisionphysicstrigger

Faking "Destructible" structures with groups of rigid bodies

I want to set up groups of prefabs with rigid bodies on them as structures, which can be "exploded" when a projectile collides with it.

I am able to get several rigid bodies reacting at once, but in order to be more efficient (and build a bigger "city"), I thought it might be a good Idea to set up some sort of trigger system so that the structures which are not being affected, will not add stress to the physics engine.

Essentially, the structures would be converted from a static object to a group of rigid body prefabs on collision. Is there a way to turn the physics for objects on and off like that? As a noob to scripting in general, I am unsure of how to go about setting this up... any help would be greatly appreciated. Thanks.

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

4 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by duck · Feb 09, 2010 at 05:31 PM

You might find that simply ensuring that all your unexploded rigidbody structures are sleeping is enough to get good performance out of the engine.

Sleeping rigidbodies cause very little performance drain. See the manual page for Rigidbody.Sleep.

Edit: Another nice touch can be to create physics joints between the rigidbodies with a fairly low break force, which means that structures can collapse more realistically rather than just "falling apart" when hit.

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 Shadyfella13 · Feb 09, 2010 at 06:09 PM 0
Share

Thanks again Duck... this was exactly what I was looking for. :)

avatar image
1

Answer by Ashkan_gc · Mar 08, 2010 at 02:27 PM

i added a feature request to feedback about what you want to do. i requested a feature to create destructible meshes. go to this link and vote for it please. the feature is not that hard to implement just a mesh spliting algorithm is needed so if we vote enough they'll add it. all physx needed features are currently supported in unity. http://feedback.unity3d.com/forums/15792-unity/suggestions/536687-destructible-meshes

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 Shadyfella13 · Mar 16, 2010 at 01:17 AM 0
Share

yep ... did it bro. Here's for hoping! ;)

avatar image
-1

Answer by efge · Feb 09, 2010 at 06:38 PM

I would suggest the 'trigger system' because you don't have to take care about the rigid-bodies and you get much better graphic performance for your large city. One simple box collider as a trigger per building or block with shared materials will reduce draw calls for the undestroyed part. When switching to destroyed or exploded you then could use other materials, add geometry like debris , ...

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 efge · Feb 10, 2010 at 05:02 PM 0
Share

http://www.pixeluxentertainment.com/ ... just as a reference :-)

avatar image
-1

Answer by Ashkan_gc · Feb 09, 2010 at 08:18 PM

you can use another prefab of your object with rigidbodies attached and destroy your normal object and instantiate that rigidbody enabled one to destruct it. also you can add and remove rigidbody component but it's harder to adapt with changes and less reusable.

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

No one has followed this question yet.

Related Questions

overlapsphere to destroy NPCs on exit 1 Answer

Prevent shooting when gun is inside wall 1 Answer

Trigger Colliders: Is there a way to simulate a non-trigger collider? 0 Answers

How do i get OnTriggerStay2D to work? 1 Answer

OnTriggerEnter2D not Working 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