Version: 2022.1
言語: 日本語

説明

ゲームオブジェクトにアタッチした Joint2D が壊れたときに呼び出されます。

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, OnJointBreak2D will be called and the specific Joint2D that broke will be passed in. After OnJointBreak2D is called, the joint will automatically be removed from the game object and deleted.

関連項目: Joint2D.breakForceJoint2D.breakTorqueJoint2D.reactionForceJoint2D.reactionTorque

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); } }