- Home /
Not detecting collision?
void OnCollisionEnter(Collision col){
if (col.gameObject.tag == "Arrow") {
Debug.Log ("we should die now");
Die ();
}
}
but when the player gets hit by the arrow it doesn't call die or the debug.log.
i don't know why this is not working.
"when the player gets hit"
if that were true you would see the debug log, so the player couldnt be getting hit. Check your physics matrix. $$anonymous$$ake sure you have a rigidbody on the object
the player does have rigidbody and the arrows do stop when they hit the player.
A non-kinematic rigidbody? and both the player and arriw have colliders not marked as triggers?
the ridgidbody is kinematic and are the colliders suppose to have triggers?
the ridgidbody is kinematic and are the colliders suppose to have triggers?
No... read my last comment. NOT kinematic. Colliders NOT triggers.
$$anonymous$$inematic means the rigidbody is working outside the Unity physics system. Is that your intention? Is your Debug statement working? Is there a reason you're not using GameObject.CompareTag()?
I just need it to check if the tag of the object it was hit by is "Arrow".
Answer by SPOTNINJADUD7890 · Oct 23, 2016 at 04:01 PM
void OnControllerColliderHit(ControllerColliderHit col){
Debug.Log ("Called");
if (col.collider.tag == "Arrow") {
if (GetComponent<PhotonView> ().isMine) {
Debug.Log ("we should die now");
Die ();
}
}
}
I switched to that but now its calling the debug but when i hit the arrow it still does not work.
the first debug.log("called") is calling but when i touch the arrow nothing happens please help!
Are you calling the OnColliderHit function from the arrow or from something else?