I am moving a transform object but i need it to always face forwards. Any help appreciated.
function Update ()
{
if (activeTrail.length < 1)
// If we have no positions in the trail, we have nothing to do in Update
{
return;
}
transform.position = Vector3.Lerp (transform.position, activeTrail [0], Time.deltaTime * speed);
// Move towards the next position in the trail
if (Vector3.Distance (transform.position, activeTrail [0]) < nearDistance)
// If we have arrived at the next position in the trail, then...
{
activeTrail.Shift ();
// ... remove that position from the trail - making the next on the list our new destination
UpdateLine();
}
}