标签:called ejs oid tps events http varname using strong
当蛇头碰撞到蛋的时候 应该让蛋消失并且重新创建蛋。
void OnTriggerEnter 可以使用这个方法 下面附有这个方法的介绍
其次需要对挂载在之上的Object check IsTrigger 属性。
如果是 Prefab 预设体 需要在预设体处 进行Apply 操作。
MonoBehaviour.OnTriggerEnter(Collider)
other | The other Collider involved in this collision. |
OnTriggerEnter is called when the Collider other
enters the trigger.
This message is sent to the trigger collider and the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Notes: Trigger events are only sent if one of the colliders also has a rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. (碰撞的两个物体必须要有一个具有刚体属性)
// Destroy everything that enters the trigger
function OnTriggerEnter (other : Collider) { Destroy(other.gameObject); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnTriggerEnter(Collider other) { Destroy(other.gameObject); } }
OnTriggerEnter can be a co-routine, simply use the yield statement in the function.
标签:called ejs oid tps events http varname using strong
原文地址:http://www.cnblogs.com/mythdoraemon/p/7041358.html