I’m making a character that you click and he walks the next spot you click. I already got him to move where I click but he moves there in about 2 frames and I can’t slow it down.
heres what i mean
public GameObject ObjectToMoveTo;
void Update()
{
//transform the player to ObjectToMoveTo at a controllable
//speed with out useing look at
}
Vector3.MoveTowards() is what you are looking for
public class Example : MonoBehaviour {
public Transform target;
public float speed;
void Update() {
float step = speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}
}
I think it is a very useful question that deserves to be answered for everybody to learn.