I’ve been trying to get my gameobject to rotate back and forth using Mathf.PingPong. It only goes from origin to rotFl. I need it to go from origin to rotFl then switch to from origin to -rotFl. Any ideas for what I should put in the if statement so that the switch occurs? I’m thinking it’s something like if it retreats back to origin but I’m not sure.
public float rotFl;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.localEulerAngles = new Vector3(0, 0, Mathf.PingPong(Time.time * 50, rotFl));
/*if( check something so that switch occurs){
transform.localEulerAngles = new Vector3(0, 0, Mathf.PingPong(Time.time * 50, -rotFl));
}*/
}