Hey guys
I have set up a movement logic using A* I’m happy with. Using AIDestinationSetter along with FollowerEntitity. Works great. But I’m having a lot of trouble figuring out a way to control the enemy’s rotation in a natural way.
The behavior I’m looking for is to control where the enemy is looking at different times. Running at full speed down a hallway around corners? Face the movement direction as is the default, great. Moving towards a location to search for something? Face the movement direction as well.
But when chasing a player and the enemy is close to the player, perhaps when moving around a table? The enemy should look at the player instead. It should perform a strafing movement. As one would when chasing (or even how a player moves in an FPS game).
I read that FollowerEntity.SetDesination() has a facingDirection overload, but I can’t seem to make it work as intended. It more behaves like a way to “hone in on the position” when approaching the destination. But that’s not what I want. The way the enemy movies position wise is great - it’s only the “visual look” of the rotation that is to be modified.
But anyways, I would love to not even use FollowerEntity.SetDesination()… as I am using AIDestinationSetter.target() to continously track a moving object (the player) as I can understand that is the prefered way to handle tracking moving targets.
Using these two components - how do I control the rotation of the enemy in a dynamic way? To switch back and forth of the default behavior… but take control of it, even lerping it, when needed?
Thanks
/Alex
- A* version: 5.2.4
- Unity version: 6.000.023f1