Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class EnemyAi : MonoBehaviour
- {
- //I feel like this shouldn't be explained
- public Transform pointA;
- public Transform pointB;
- //How fast it moves
- public float speed;
- // Update is called once per frame
- void Update()
- {
- //Usng a Sin Fuction we will this object will move to pos A and pos B forever
- transform.position = Vector3.Lerp(pointA.position, pointB.position, Mathf.Sin(Time.time * speed));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment