issue after 360 degrees rotation

hi everyone.

i’m able to rotate my object weel for 360 degreese with the following code

    private IEnumerator Rotate(
 
        float in_deltatime,
 
        int   id,
 
        float duration,
 
 
 
        EInputState in_secondState)
 
    {
 
        Vector3 rot               = _players[id].transform.rotation.eulerAngles;
 
        float endRotation         = rot.x + 360.0f;
 
        float t                   = 0.0f;
 
 
 
        while ( t < duration )
 
        {
 
            if ( _stopRotation[id] == true )
 
            {
 
                yield break;
 
            }
 
 
 
            t                     += in_deltatime / duration;
 
            float moveAngle           = Mathf.Lerp(rot.x,endRotation,t);  
 
            Vector3 fixedRot      = new Vector3 (-angle,rot.y,rot.z );
 
            _players[id].transform.rotation = Quaternion.Euler( fixedRot );
 
 
 
            yield return null;
 
        }
 
 
 
    }

but the problem with is is that after this rotation i’ll get an player x value of 500 or more…but what i need is to restart from where it was starting his rotation let’s suppose -170, so that’s my problem… how to put back it?

I think you just set it back to rot variable u stored at beginning.

Insert this line _players[id].transform.rotation = Quaternion.Euler(rot);

above yield return null