Answers for "pointtowards unity"

C#
8

unity movetowards

float speed;
Vector3 goalPosition;

void Update()
{
	transform.position = Vector3.MoveTowards(transform.position, goalPosition, speed * Time.deltaTime); //goes from the position of the gameObject to the goalPosition in a strait line with a speed of "speed"
  	//Also works with Vector2
}
Posted by: Guest on January-16-2021

C# Answers by Framework

Browse Popular Code Answers by Language