|
Hello! Here's the deal. I got bombs (note to FBI: virtual ones). When they hit something, the bombs should spawn an immobile explosion that should deal X points of damage to all objects in range. Now, I currently have a prefab for that explosion object. On that object is a trigger collider, a script, and a few other irrelevant components. In the script I react to OnTriggerEnter(), but that apparently is very unreliable. I read elsewhere that colliders are quite finnicky, especially when spawned within each other. Might that be my problem? Or maybe there has to be movement in order for collisions to register? How would you go about applying instant damage to all objects within a collider that was just spawned? Thanks!
(comments are locked)
|
|
I believe that what you could do is use a spherecast with a radius of your explosion(http://unity3d.com/support/documentation/ScriptReference/Physics.SphereCastAll.html) . Then apply explosion force depending on how far away from the explosion the objects are. Hope this helps! Hmmm, a sphere cast you say? I like it! Dunno how it's gonna cope with a distance of zero, but I'll try that out. Thanks!
May 12 '11 at 04:24 PM
microp
I liked the visual, intuitive setup of the collider though. Also, is there a way to get the layer mask from the project physics settings?
May 12 '11 at 04:31 PM
microp
I also liked the Enter and Exit notifications. Bleh, I really wish colliders weren't so broken.
May 12 '11 at 05:07 PM
microp
Who says colliders are broken? Where did you "hear" this?
May 12 '11 at 07:31 PM
flaviusxvii
(comments are locked)
|
