Hello there! I seem to have run into a snag! I have a capsule collider at the feet of my player so that they don’t run through objects, and a boxcollider2D with “Set Trigger” enabled to work as a hitbox.
The problem is this: the projectiles will hit the player and trigger the TakeDamage() Function, but only if they hit the capsule collider at the feet of the player.
How do I address the projectiles passing through the boxcollider2D is trigger component?
The course just uses the collider at the player’s feet, which fits with the idea of the character being “in front of” shots that are behind the player.
That being said, I believe @Satinel’s solution should make the 2nd collider work properly.
Once the ghost was firing the shots at the player’s transform, despite the fact that the player’s hitbox was relatively small, the enemies still landed their shots consistently, and it still felt right.
After playtesting a little bit, I think the box collider 2d is just too big, and by the time I shrink it to a size that feels right, it’s roughly the same size as the player’s original capsule collider, so I think I may just stick with the original capsule collider. Though, maybe I’ll try adding a larger hitbox to enemies later via this logic to make player aiming a little bit easier!
Thanks for helping me test the option of a hitbox, @Satinel ! I got a little stuck there without your help!