Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Solved] Question - Destroy object with gravity

Discussion in 'Scripting' started by kholyphoenix1, Nov 18, 2015.

  1. kholyphoenix1

    kholyphoenix1

    Joined:
    Apr 17, 2015
    Posts:
    57
    Hello,

    How do I gravity destroy an object into several fragments and then do the fragments disappear?
    I tried using more RigidBody believe this case is really just script.
    PS.: C#

    Thanks a lot!
     
  2. IroncladEarl

    IroncladEarl

    Joined:
    Jul 3, 2013
    Posts:
    87
    Are you trying to destroy the object if the impact is too strong? Sorry, not understanding.
     
    kholyphoenix1 likes this.
  3. kholyphoenix1

    kholyphoenix1

    Joined:
    Apr 17, 2015
    Posts:
    57
    I want the object to be destroyed in several fragments. When gravity is disabled on the object. Or something.
     
  4. IroncladEarl

    IroncladEarl

    Joined:
    Jul 3, 2013
    Posts:
    87
    So you could probably create the fragments (with rigidbody disabled) and put them together as children of a parent object. When gravity stops working (or whatever your trigger is), you can then enable their rigidbodies and then create a Rigidbody.AddExplosionForce in the center. This should trigger a countdown on the parent and then the parent is destroyed.
     
  5. kholyphoenix1

    kholyphoenix1

    Joined:
    Apr 17, 2015
    Posts:
    57
    Ah thanks!!