I don’t really get what I’m doing wrong. I’m new to scripting and am determined not to just use packages, as I do want to learn to script. There are no error messages and the x, y and z variables of dest don’t change when I click. Could someone give me a rundown of what I’m missing please?
#pragma strict
var dest : Vector3;
function Update () {
if(Input.GetKey(KeyCode.Mouse0)){var hit : RaycastHit; var ray : Ray = camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(ray.origin, ray.direction*10,Color.yellow); dest = hit.point; Vector3.MoveTowards(transform.position,dest,10*Time.deltaTime);
} }