|
Edited to hopefully show up in more responses: I have a script that is intended to check an objects tag upon any collision and if it meets my conditions then destroy both objects and spawn in a new bigger one in the same place as the first object that collided. My problem is that instead of two smaller objects becoming one larger one as intended, I end up with two larger ones.
I thought that the bubSize var would stop it from triggering again since it would no longer be 0 but that and a bunch of other checks and balances I've tried have failed. It seems like it's going to call OnCollisionEnter twice no matter what. Please help out with this specific script and be succinct. If I get a JavaScript answer that solves my issue I will happily mark it as solved and upvote it if you can refrain from using the words "simple", "simply", and the phrase "Mouthbreathing Idiot!". :) --Goody!
(comments are locked)
|
|
If the script is attached to both objects, it will be run twice when the collide, once on each object, because each object detects the collision independently. Try checking not just the bubSize of the object the script is, but also the bubSize of the other object. Yup, you got it! I'm new at Instantiate and didn't figure out that both objects are calling on collision at the same time. Doh! I've now moved the qualifying vars outside of the original script and don't have the same problem anymore. Thanks! Solved! Upvoted!
Dec 14 '09 at 01:42 AM
Goody!
(comments are locked)
|

I removed the javascriptspecific tag since the question is relevant regardless of language choice.