// Update is called once per frame void Update() { Vector3 moved = transform.position - lastPos; RaycastHit hit; if (Physics.Raycast(transform.position, Vector3.down, out hit, Mathf.Infinity, mousePad)) { cursor.AddToTargetLocation(new Vector2(moved.x * moveSpeed.x, moved.z * moveSpeed.y)); } lastPos = transform.position; }