|
Hi, Was wondering if there is a way to have a bullet (with collider) be destroyed when it hits any object's collider (enemy/wall, etc), rather than specifying an individual collider. What's the best method to use? OnCollisionEnter, OnTriggerEnter, Ray casts, and how? Thanks
(comments are locked)
|
|
hopefully I'm not mistaken in saying that this will check for any collisions with the bullet Hope that works! Scribe NOTES:
May 20 '12 at 05:44 PM
aldonaletto
Correct me if I am wrong, but the bullet does not need a rigidbody as long as the gameObject it touches is a rigidbody, right?
May 20 '12 at 05:50 PM
OrangeLightning
@OrangeLightning : I almost asked that also lol ... but figure since they want the bullet to destroy itself when it hit's "anything" , then it's either the bullet has a rigidbody, or would have to make sure "everything" else has a rigidbody on it.
May 20 '12 at 05:54 PM
Lo0NuhtiK
Yes, in theory at least one of them must be a rigidbody - but moving a non-rigidbody object do not awake the hit rigidbodies (the object passes through them), thus it's better to make the bullet a rigidbody.
May 20 '12 at 06:13 PM
aldonaletto
Actually it's important that only one of the elements has a rigidbody. I f the bullet has one and the wall (for example) has one too, the collision will not be detected. If both have a rigidbody, one has to be convex
May 20 '12 at 06:23 PM
KiraSensei
(comments are locked)
|
