Version: 2017.1

MonoBehaviour.OnJointBreak2D(Joint2D)

Cambiar al Manual

Descripción

Called when a Joint2D attached to the same game object breaks.

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.

See Also: Joint2D.breakForce, Joint2D.breakTorque, Joint2D.reactionForce y Joint2D.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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961