Spell Backfired: Stop hitting yourself

I don’t know if it was hidden in there and I only just now noticed, but occasionally my fireballs blew up in my face. I think it has something to do with casting with the item attack animation? (more pronounced on hills) It looks like sometimes is calls Shoot before the animation hits the right frame?

pow_lossy100

I tried disabling the collider on the projectile and turned it back on in Update and that cleared up most but not all.

The collider I am using is a small sphere in the front edge of the core, so it should not have ever been inside the player capsule.

For now I have swapped the animation to use the Bow so the hand is always outside the capsule.

The OnTriggerEnter is registering the collision with the shooter (you). Technically, it’s realistic, like fumbling the handgrenade (we recommend against fumbling handgrenades here at GameDev).

At some point (not sure if we already have), we should be passing the owner to the projectile so that we can give credit where credit is due for the kill…
Once you’ve got the owner, at the beginning of the projectile’s OnTriggerEnter, add this line:

if(other.gameObject == owner) return;
1 Like

Weird. This didn’t give me a notification. It was covered a little later in Experience. Up to that point I was considering avoiding the issue by making an eXPlosion radius and allowing enemies to level up to discourage sniping. As I looked forward though towards adding other rewards like reputation/kill counts I was going to need the owner anyway so best to get it done early.

Privacy & Terms