var targetA : Transform;
var targetB : Transform;
private var currentTarget : Transform;
var proximity : float = 1.0;
var speed : float = 1.0;
//with function Start we set at start the current target
function Start ()
{
currentTarget = targetA;
}
function Update ()
{
var Distance : Vector3 = currentTarget.transform.position - transform.position;
//if “player” is “1” unit far, change currentTarget to next one
if(Distance.magnitude < proximity)
{
switch(currentTarget)
{
case targetA:
currentTarget = targetB;
break;
case targetB:
currentTarget = targetA;
break;
}
}
transform.position = Vector3.Slerp(transform.position, currentTarget.transform.position, Time.deltaTime * speed);
//make object look towards currentTarget
transform.LookAt(currentTarget);
}
I put this script into the (seagull which i get from islandDemo) and its not function
the seagull(transform.LookAt(currentTarget);)is not flying with looking at front whereby it flight by side,why???
any1 have solution? pls help me