- Home /
 
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?
Answer by Kudorado · Dec 26, 2018 at 04:48 AM
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 
Your answer
 
             Follow this Question
Related Questions
help me to rotate an object 1 Answer
Odd rotation on the wrong axis 0 Answers
Flip over an object (smooth transition) 3 Answers
Rotation 90.0001 and 1.001719 bugs! 1 Answer
How to make a plane face a static but rotating camera? 3 Answers