How to break a joint in Unity?

The task is to make a bicycle. When a stone is thrown to the bicycle, the bicycle should be scattered in different parts.

I’ve made the bicycle with bicycle frame and wheels and join them using Wheel Joint. I need to know how can I break these joints using Script or anything?

Assuming you have a reference to the joint component, you can break it like this:

Destroy(joint);

When joints snap by physical forces, their components are also destroyed. They will send the OnJointBreak(float breakForce) message to any monobehaviours attached to the object.

Cheers

If you have a situation where you want to be able to activate/deactivate the joints repeatedly, I’ve had some success in the past by removing/adding the connected body reference, rather than continually destroying/creating the hingeJoint:

// break joint connection:
gameObject.GetComponent().connectedBody = null;

Although if it’s a one-time break, then HarvesteR’s method is probably better.