Hi im creating an AI Script and i am starting to look away from the dodgy things i started out with such as the LookAt() for Ai.
reason being is i cant use velocity to track its rotation to play the appropriate animations and i want to learn something new.
what i have tested is
Cross Product
Dot Product
and also manually altering the rotations of the enemy, i have successfully done so using a rigidbody with Getcomponent().angularVelocity , this also plays the correct animation when done so, but the issue im having is getting the enemy to stop rotating when he is facing the player, i know i can hack this in with a simple raycast, if hit player move forward and stop rotating, but the issue with that approach would be when its not hitting the player how does it know how to turn CW or CCW ??
so i have been digging for a different approach and thought i would turn to the community for some help with this.
essentially i have a few waypoints on the map to test with atm but i cant seem to get the AI to face the object, and i do not want to resort in using Transform.LookAt() as it defeats the purpose. and can not play animations such as rotating as it locks to the object and does not Slerp to it. i do see this question posted a fair bit, but their never seems to be an answer to the question that works.
Thanks in advanced for taking the time to pitch in to this topic.