Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
CharacterController.detectCollisions 检测碰撞
# [CharacterController](CharacterController.html).detectCollisions 检测碰撞 var *detectCollisions* : bool *Description* 描述 Should other rigidbodies or character controllers collide with this character controller (By default always enabled) 其他的刚体和角色控制器是否能够与本角色控制器相碰撞(默认值始终启用) This method does not affect collisions detected as part of the character movement. Instead it controls collisions between the controller and other objects. For example a box will block the movement of the controller, but the box can fall through the controller as part of the simulation. This is useful to temporarily disable the character controller. Eg. you might want to mount a character into a car and disable collision detection until you exit the car again. Note that this only affects other bodies to not collide with r detectCollisions is not serialized. This means, it doesn't show up in the inspector and when Instantiate'ing the controller or saving it in a scene it will not be saved. 这个方法不影响被检测为角色运动部分的碰撞。相反,它控制控制器与其他物体之间的碰撞。例如,一个盒子将阻碍控制器的运动,但是盒子作为部分模拟能够穿过控制器。这对于暂时禁用角色控制器来说是非常有用的。例如,你可能想把一个人物放进一个汽车里并且禁用碰撞检测,直到你又走出汽车。注意,这只影响其他的物体,使它不与没有序列化的 r 检测碰撞相碰撞。它的意思是,它并不在检视面板中显示,而且当在场景中实例化或者保存控制器时,它将不被保存。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public CharacterController c; public void Awake() { c = GetComponent<CharacterController>(); c.detectCollisions = false; } } ``` ``` var c : CharacterController; c = GetComponent(CharacterController); c.detectCollisions = false; ```
da
2022年5月17日 17:28
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码