Trying to Flip Object when its target moves behind it, and recreate (flipped) the attached physics objects when it flips.
This works the first time, exactly as intended, flipping 180 to face a target that moves to the other side and recreating the ‘head’ object flipped.
But when the target moves back to the first side, it doesn’t flip back, despite it again meeting the condition for ‘is not rotated towards’.
Any help would be appreciated.
There are no events to unflip the Player_Test object.
Flip doesn’t mean to flip it in the opposite direction to what it is. It means to flip it so it’s opposite to how it starts off. So if a player is normally facing left, then flip makes it a mirror image so it faces to the right. No amount of further flipping will cause it to face it’s original. For that, you need to set flip object to “no”.
All you do when then player is not rotated towards the enemy is horizontally flip the player. But there are no events to reverse this
Thank you for your help!
After your advice (and realizing also that only the sprite, not the rotation angle, was flipping) I found this now works as intended:
@MrMen is right. I also had this same problem with one of my own games.What i did was that i just added raycasting to angles 180 and 0(left and right).and if the raycast detected the player it would tell the enemy to flip(if the180 degree raycast detected the player).