找回密碼
 注冊帳號

掃一掃,訪問微社區

charactercontroller.detectcollisions 檢測碰撞

2015-1-4 10:27| 發布者: 楊炎| 查看: 2221| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: charactercontroller.detectcollisions 檢測碰撞vardetectcollisions: booldescription描述should other rigidbodies or character controllers collide with this character controller (by default always enabled ...

charactercontroller.detectcollisions 檢測碰撞

vardetectcollisions: bool

description描述

should other rigidbodies or character controllers collide with this character controller (by default always enabled)

其他的剛體和角色控制器" target="_blank" class="relatedlink">角色控制器是否能夠與本角色控制器相碰撞(默認值始終啟用)

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();

c.detectcollisions = false;

}

}

var c : charactercontroller;

c = getcomponent(charactercontroller);

c.detectcollisions = false;

相關閱讀

文章點評
相關文章
女校游泳队彩金