1. 程式人生 > >unity3d 簡單碰撞檢測程式碼

unity3d 簡單碰撞檢測程式碼

function OnCollisionEnter(theCollision : Collision){

if(theCollision.gameObject.name == “Floor”){

Debug.Log(“Hit the floor”);

}else if(theCollision.gameObject.name == “Wall”){

Debug.Log(“Hit the wall”);

}
}