Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Transform.IsChildOf 是否子物体
# [Transform](Transform.html).IsChildOf 是否子物体 function *IsChildOf* (*parent* : [Transform](Transform.html)) : bool *Description* 描述 Is this transform a child of parent? 这个变换是父级的子物体? 就是说判断这个物体是否是子物体。 Returns a boolean value that indicates whether the transform is a child of a given transform. true if this transform is a child, deep child (child of a child) or identical to this transform, otherwise false. 返回布尔值,是指这个变换是否是指定变换的子物体。如果这个变换是一个子物体、深层子物体(孩子的孩子)或者同级这个变换,返回真,否则返回假。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { void OnTriggerEnter(Collider col) { if (col.transform.IsChildOf(transform)) return; print("Do something here"); } } ``` ``` function OnTriggerEnter (col : Collider) { // Ignore trigger events if between this collider and colliders in children // Eg. when you have a complex character with multiple triggers colliders. //如果这个碰撞器和碰撞器的子物体之间,忽略触发器事件 //例如,你有一个复杂的角色,带有多个触发碰撞器。 if (col.transform.IsChildOf(transform)) return; print("Do something here"); } ```
da
2022年5月23日 14:49
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码