- Home /
onCollisionEnter2d spawn - unity 4.6
my understanding of onCollisionEnter2D was that a collision would not be detected if the object was spawned inside Another collider.
I have airplanes that cross the screen and drop bombs, which I want to explode when they hit the ground. the planes can pass through walls. If I instantiate the bomb inside the walls collider, the onCollisionEnter2d fires and it explodes immediately. what I want is for the bomb to drop and only explode if it's hitting a wall after it's exited the wall it was spawned in. Bombs aren't always spawned inside a wall, sometimes there is nothing there in which case the current method works fine.
How come the onCollisionEnter2d is firing during instantiation? any simple solutions for this. I could set an armed flag when the bomb exits the wall but they aren;t always spawned inside a collider.
any suggestions?
Your answer
![](https://koobas.hobune.stream/wayback/20220613192237im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trigger Spawning? 1 Answer
Do triggers not fire if spawned colliding? 1 Answer
Spawning explosions and detecting objects in range 1 Answer
Do 2 Triggers Collide? 1 Answer