using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bounce : MonoBehaviour { private float height = 10.0f; private float myAngle = 0.0f; // Use this for initialization void Start () { } // Update is called once per frame void Update () { myAngle += 1.0f; if (myAngle > 360.0f) myAngle -= 360.0f; //This keeps bouncing up and down transform.position = new Vector3 (0.0f, Mathf.Abs(Mathf.Sin(myAngle * Mathf.PI/180.0f)) * height, 0.0f); } }