So I have everything worked perfectly with this
public float amplitude;
public float speed;
private float startPosition;
private Vector3 tempPos;
void Start ()
{
startPosition = transform.position.y;
}
void Update ()
{
tempPos.y = startPosition + amplitude * Mathf.Sin (speed * Time.time);
transform.position = tempPos;
transform.Rotate (0,0,300*Time.deltaTime);
}
the only problem is that the object always start in the center moving up and down. How do i make it so it stays where I position them?