I’m trying to get the Player Laser to interact with the Enemy Bomb.
I tried adding the ‘Enemy’ script, but that didn’t work. Is it the Layer that needs to be adjusted?
I’m trying to get the Player Laser to interact with the Enemy Bomb.
I tried adding the ‘Enemy’ script, but that didn’t work. Is it the Layer that needs to be adjusted?
Hi,
Have you already tried to add Debug.Logs to your code to see what is going on during runtime?
This is what I have so far:
Dubugs for the collision, the damage dealer, and the destruction.
There is no collision between Player Laser and Enemy Bomb.
Debug log shows collision only when the bomb interacts with the Shredder at the bottom.
Red errors are because I plunked an enemy in the scene when it wants to be part of a spawn path.
Have you already used layers and the layer collision matrix? If so, maybe the laser is on a layer which does not interact with the player.
Or both the laser and the player have got trigger colliders.
Collision boxes here: I’ve messed with checking and unchecking boxes, still not getting collision between Player Laser and Enemy Bomb (Enemy Projectile).
Still no luck with making the Enemy Bomb destructible as an Enemy Projectile. I messed with a lot of the settings in the layer collision matrix.
I changed the Enemy Bomb from the Layer: Enemy Projectile to Layer: Enemy and the bomb is now destructible.
I still don’t understand why it wasn’t working as an Enemy Projectile.
Full Fix:
Good job on fixing the issue, and thanks for sharing your solution.
One last thing you could check: In your last screenshot, I can see that the Body Type of the Rigidbody2D component is set to “Kinematic”. Take a look at the collision action matrix at the bottom of this webpage:
Maybe both “colliding” colliders were kinematic. That would explain why certain collisions didn’t work.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.