- Home /
Not Want to have effect of AddExplosionForce() on some Cars(some GameObjects) ?
Hi i have user AddExplosionForce() to have explosion effect...but i do want this explode for on some cars while it executes...
it means when Any Game Object blast then AddExplosionForce() executes....
Near by cars of same team will have this explosion effect..and throw away... Near by cars of other team win not have this explosion effect...they just stand on their place...?
Answer by ibrarOzi · Nov 17, 2017 at 11:05 AM
Do a Sphere cast with a layer mask, The layer mask will filter the only game objects which are required so you can apply explosion on them
You can also do this with tag, before applying explosion force check the tag and then apply it.
AddExplsionForce Will apply to all the non statics rigidbody game objects...?
Yes, AddExplosionForce is applied to all the rigid bodies but the kinematic one didn't respond to the applied force
Answer by ZeN12 · Nov 21, 2017 at 09:19 AM
You can use Physics Layers, it will ignore colliders (gameObject) with specific tag. Doc: https://docs.unity3d.com/Manual/LayerBasedCollision.html