Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

OnJointBreak2D

Discussion in 'Physics' started by philyum, Jun 14, 2017.

  1. philyum

    philyum

    Joined:
    Dec 16, 2013
    Posts:
    12
    I am making a physics game with joint break forces, but I need to be able to revert objects back to a previous state. Problem is that when a joint breaks it disappears automatically.

    Is there a way to just disable joints instead of destroying them when they break?

    EDIT: Came up with a sort of hack.
    1. When joint breaks, make a clone of the object with the joint and disable the clone (invisible)
    2. Save the clone to a list
    3. When time to recover, for each clone add component back to original and copy properties over
    4. Destroy clones
     
    Last edited: Jun 14, 2017
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,546
    When I implemented the breakable 2D joints, I copied the existing functionality of 3D joints which is to delete the component however I think it's a good idea to have the option to either destroy or disable the joint. I will add this as a feature request and see about getting it done sooner rather than later as it's a super easy thing to add.
     
  3. philyum

    philyum

    Joined:
    Dec 16, 2013
    Posts:
    12
    Thank you so much!