Question by 
               $$anonymous$$ · Jan 11, 2017 at 12:21 PM · 
                2drotationquaternionspeedangle  
              
 
              Shortest Rotation Path at Constant Speed
Hi,
I have TargetAngle, CurrentAngle and SpeedVariable. I want to make a transition from one angle to the other one at the CONSTANT SPEED ALL TIME.
I’m using Quaternion.Lerp but it gets slow or fast depending on the distance, I don’t want that.
I want the transition at SAME SPEED (No matter how long it takes to get to that angle).
Thanks a lot if someone knows :)
(the purpose of my project is rotate a 2D sprite along Z axis, using the shortest path)
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by LK84 · Jan 11, 2017 at 12:55 PM
You are better off using Quaternion.RotateTowards
 Update()
 {
     transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, speed* Time.deltaTime);
 }
Solved, thank you
I was getting complicated in those first two lines:
 Quaternion targetPos = Quaternion.identity;
 targetPos.eulerAngles = new Vector3 (0,0, myTargetangle);
 myPlayer.transform.rotation = Quaternion.RotateTowards (myPlayer.transform.rotation, targetPos , mySpeed*Time.deltaTime);
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                