Hi there i’m working on a game idea but im having problems with this script
var target: GameObject;
var direction: Vector3;
var state = "ATTACK";
private var startingPosition:Vector3;
private var rotationSpeed = 4;
var attackDistance = 60;
var retreatDistance = 10;
var speed = 0.3;
function Start ()
{
target = GameObject.Find("Base");
startingPosition = this.transform.position;
}
function Move ()
{
this.transform.rotation = Quaternion.Slerp(transform.rotation.Quaternion.LookRotation(direction).rotationSpeed * Time.deltaTime);
this.transform.Translate(Vector3.forward * speed);
}
function Update ()
{
direction = target.transform.position - transform.position;
//determine state
if(direction.magnitude > attackDistance)
{
state = "ATTACK";
}
else if (direction.magnitude < retreatDistance)
{
state = "RETREAT";
}
//act on state
if(state == "ATTACK")
{
Move();
}
else if (state == "RETREAT" )
{
direction *= -1;
Move();
}
}
here is the error
Assets/Scripts/Attack.js(19,51): BCE0017: The best overload for the method ‘UnityEngine.Quaternion.Slerp(UnityEngine.Quaternion, UnityEngine.Quaternion, float)’ is not compatible with the argument list ‘(System.Object)’.
any help would be great