- Home /
 
 
               Question by 
               Rybo5000 · Sep 27, 2012 at 07:48 AM · 
                rotationjavascriptdesignclock  
              
 
              Rotation changes direction for no reason?
 transform.RotateAround(pivot.position,Vector3(0,0,1),hours*30);
 
               I'm trying to do a simple clock where the hand rotates but I've found that sometimes it rotates clockwise and othertimes it rotates anticlockwise. Is there a reason for this that I'm missing?
Note: the pivot is a small empty object at the centre of the clock/base of the hand. It needs to rotate around the Z axis and hours*30 is the space between each number on clock.
               Comment
              
 
               
              suggest U add the two lines of code
 Debug.Log("I am about to do hours: "+hours);
 Debug.DrawLine(pivot.position,pivot.position+Vector3(0,0,1),
                             Color.blue,5);
 
                  directly before the line of code you quote
Your answer