With the refactor to IDamageable
in this lecture we use the _fireDirection
Vector2 which is passed through to Knockback
. For me this sometimes pushes enemies in the expected direction, the one the bullet is travelling in, and at other times it instead pulls the enemies toward the bullet’s origin point. At first I thought it was dependant on which direction the player was facing, that it might be due to changing the player’s rotation. With further testing that doesn’t seem to be the case, it seems like it depends on the enemy’s position in the world more than anything else.
The issue is almost definitely to do with using _fireDirection
, replacing it with PlayerController.Instance.transform.position
or the bullet’s transform.position
works perfectly fine. I just can’t figure out the why of it, or if anyone else has experienced this behaviour.