- Home /
 
 
               Question by 
               Pablomz7 · Feb 06, 2014 at 08:40 AM · 
                rotationanglerotatearoundcircle  
              
 
              Rotation circle to stop at a certain angle
I'm trying to make a "model selector" with swiping. When i swipe, it has to turn 72 degrees and stop, when i swipe again, it has to do the same.
This is what I've got:
     void OnSwipe(SwipeInfo sw){
         if(sw.direction.x >= 0){
             rotationAngle = 72;
             rotationSpeed = -36f;
 
         }else{
             rotationAngle = -72;
             rotationSpeed = 36f;
         }
 
 
 void Update () {
 
         rotationAngle += Mathf.Round(0.5f * rotationSpeed);
         if(rotationAngle == 0)
             rotationSpeed = 0;
 
         objects.transform.RotateAround(objects.transform.position,Vector3.up, 0.1f * rotationSpeed);
 
 
     }
 
               I'm trying to rotate around a centred sphere with 5 models around it in a circle.
Thanks in advance.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Pablomz7 · Feb 06, 2014 at 09:32 AM
I've solved this problem by using Mathf.MoveTowardsAngle.
http://docs.unity3d.com/Documentation/ScriptReference/Mathf.MoveTowardsAngle.html
Your answer