Hi Guys, im having some trouble with my Unity Collision code and i really cant tell whats going wrong.
void OnCollisionEnter(Collision target){
if (target.gameObject.tag == "Player"){
print ("bang");
if(drilling == true){
Destroy(gameObject);
}
}
}
I added the print statement to help detect where my code was going wrong but even that didn’t appear.
I am trying to make it that my character will destroy the the object when they touch it (and are drilling). but I also want the player to not just pass through the object (like with trigger events)
There is a pretty good thread about character controller collision [here][1] In [This Link][2] it shows the use of OnControllerColliderHit but it may have some limitations that are discussed in the first link. [1]: http://forum.unity3d.com/threads/96177-Character-controller-Collision-Detection [2]: http://answers.unity3d.com/questions/199010/how-to-get-collisions-on-character-controller.html
– GlisterThis may be an edge case, as the inspector for the .asset does not have any options (ie. the readable option that is usually on obj, fbx assets etc) Although I've just realised the OP doesn't fit what I was trying to do (googling for) anyway :)
– SoylentGraham