Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float speed = 2.0f;
- public Transform goal;
- public float accuracy = 0.1f;
- void LateUpdate()
- {
- transform.LookAt(goal.position);
- Vector3 direction = goal.position - transform.position;
- Debug.DrawRay(transform.position, direction, Color.red);
- if (direction.magnitude > accuracy)
- {
- transform.Translate(direction.normalized * speed * Time.deltaTime, Space.World);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement