MonoBehaviour.OnTriggerStay2D(Collider2D)

Cambiar al Manual

Parámetros

otherEl otro Collider2D involucrado en esta colisión.

Descripción

Enviado cada frame donde otro objeto está dentro de un trigger collider adjunto a este objeto (física 2D solamente).

Información adicional sobre el otro collider se reporta en el parámetro Collider2D pasado durante la llamada.

Note: Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Mirar también: Clase Collider2D, OnTriggerEnter2D, OnTriggerExit2D.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnTriggerStay2D(Collider2D other) { other.attachedRigidbody.AddForce(-0.1F * other.attachedRigidbody.velocity); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961