unity3d的3种交互

1.角色碰撞交互

//检测角色碰撞函数
function OnControllerColliderHit(hit:ControllerColliderHit)

2.光线投射交互

//光线投射函数

Physics.Raycast(transform.position,transform.forward,hit,2)

3.触发器交互

先添加触发器(当触发器是触发模式时角色碰撞没有用)

//触发器函数

function OnTriggerEnter(col:Collider)