Version: 2017.2
public bool detectCollisions ;

Descripción

Determina si otros rigidbodies o controladores de personajes chocan con este controlador de personajes (por defecto esto siempre está habilitado).

This method does not affect collisions detected during the character controller's movement but rather decides whether an incoming collider will be blocked by the controller's collider. For example, a box collider in the scene will block the movement of the controller, but the box may still fall through the controller if detectCollisions is false. This property is useful to disable the character controller temporarily. For example, you might want to mount a character into a car and disable collision detection until it exits the car again.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public CharacterController c; void Example() { c = GetComponent<CharacterController>(); c.detectCollisions = false; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961