Hi, guy! I'm new to Unity. I've created this script to make object looping up and down. How can I move the object to the -x axis. Something like a bird tries to avoid a beam that moves up, down and movs toward to the bird.
Thanks everyone.
public class updowntest : MonoBehaviour {
public float delta;
public float speed;
private Vector3 startPos;
void Start () {
startPos = transform.position;
}
void Update () {
Vector3 v = startPos;
v.y += delta * Mathf.Sin(Time.time * speed);
transform.position = v;
}
}
↧