OnJointBreak2D(Joint2D)
Called when a Joint2D attached to the same game object breaks.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
OnJointBreak2D()
public void OnJointBreak2D(Joint2D joint2D)
Parameters
Remarks
When the Joint2D.reactionForce is higher than the Joint2D.breakForce or the Joint2D.reactionTorque is higher than the Joint2D.breakTorque of the joint, the joint will break. When the joint breaks, Joint2D.OnJointBreak2D(Joint2D) will be called and the specific Joint2D that broke will be passed in. After Joint2D.OnJointBreak2D(Joint2D) is called, the joint action depends on the option selected in Joint2D.breakAction. Additional Resources: Joint2D.breakForce, Joint2D.breakTorque, Joint2D.reactionForce and Joint2D.reactionTorque.
Examples
using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour{ void OnJointBreak2D(Joint2D brokenJoint) { Debug.Log("A joint has just been broken!"); Debug.Log("The broken joint exerted a reaction force of " + brokenJoint.reactionForce); Debug.Log("The broken joint exerted a reaction torque of " + brokenJoint.reactionTorque); }}