I’m currently using lookAt but it does not work because when the player passes the 270* angle the enemy rotates all the way in the opposite direction to face the player instead of just turning 1*.
All the tuts I’ve seen only show AI navigation and rotation on the Navmesh Agent, but I need to seperate the AIs movement and rotational destinations.
I’m still a rookie with Quaternions and Vectors, can someone please offer some insight to making an object look at something else without the weird problems mentioned above, thanks.
Hello,
I think i can recognize your problem.You can do the code instead of “lookat”.
Here is the code:
var target : Transform;
function Update ()
{
var relativePos = target.position - transform.position;
It did not work because the AI is rotating on all axis, and now is floating (even with rigidbody attatched).
I tried transform.rotation.y = rotation.y. But that did not work because like mentioned before it causes the object to stop tracking when the player moves into the 250* spot.
I need for th AI to only rotate on the Y axis towards the players general area, I’ve been experimenting for a while and not much is working, any advice is welcome
Edit :__ __NavMeshAgent.Move
I have temporarily found a fix for this problem but it is still not well suited for what I’m doing.
Solved, setting the rotation.x and rotation.z to 0 solved the problem I was having with the AI not rotating properly on an individual axis. I thought of trying that method before but I thought it wouldn’t work because it would be the same as setting: transform.rotation.y = rotation.y;
But it seems that weren’t the case - thanks for the help