- Home /
ignore collision for explosion?
hey! i have this "falcon punch" thing in my game, so actually when you punch a character, he should gets hit by a explosion force. works fine so far, but my character gets also affected by the punch and flyes away. the code looks like this:
Vector3 explosionPos = transform.position;
Collider[] colliders = Physics.OverlapSphere(explosionPos, explosionRadius);
foreach (Collider hit in colliders) {
Rigidbody rb = hit.GetComponent<Rigidbody> ();
//Add force to nearby rigidbodies
if (rb != null)
rb.AddExplosionForce (explosionForce, explosionPos, explosionRadius);
how can the character (which is the parent of this script/ the script is placed on a child sphere inside the character) be ignored by the explosion force?
Comment