I'm using xaitment plugin for Unity as the AI for a demo level but I have a problem. My character is supposed to walk to random points but while it's walking there it's rotating around the point. I can't see what is causing this in my code, I'm assuming it's something to do with my lookat function
using UnityEngine;
using System.Collections;
public class MovementGoto : MonoBehaviour {
// target position for the movement
private Vector3 mTargetPosition;
public Vector3 TargetPosition
{
get { return mTargetPosition;}
set { mTargetPosition = value;}
}
public float Speed = 40.0f;
// Update is called once per frame
void FixedUpdate()
{
// get the current steering direction to reach the target position
Vector3 walk = this.mTargetPosition - this.transform.position;
// ignore 3d
walk.y = 0.0f;
walk.Normalize();
// move into the desired direction
this.transform.LookAt(this.TargetPosition);
this.transform.Translate(walk);
}
}