Hi I am trying to implement a simple lerping to make an object to move from one to point to the next continuously, however I seem to get the following error: ‘cannot convert from unityengine.transform to unityengine.vector2’ with the code below:
public Transform StartPositionGo;
public Transform EndPositionGo;
float StartTime;
float TotalDistancetoDestination;
void Start()
{
StartTime = Time.time;
TotalDistancetoDestination = Vector2.Distance(StartPositionGo.position, EndPositionGo.position);
}
void Update()
{
float currentDuration = Time.time - StartTime;
float journeyFration = currentDuration / TotalDistancetoDestination;
transform.position = Vector2.Lerp(StartPositionGo.position, EndPositionGo, journeyFration);
}
}
So what would be a way to resolve this, thank you.