- Home /
 
 
               Question by 
               collinator7 · Aug 02, 2014 at 05:08 AM · 
                2dspritequaternionrotatetowards  
              
 
              Quaternion Rotate Towards Y Value
How do I change this line of code: transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.identity, speed * Time.deltaTime); so that Quaternion.identity only cares about rotating towards the y axis? Thanks! 
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by robertbu · Aug 02, 2014 at 05:35 AM
Words often mislead on questions like this one, and I'm doing a bit of guessing on what you want. Try this:
  var q : Quaternion = Quaternion.FromToRotation(transform.up, Vector3.up) * transform.rotation;
  Quaternion.RotateTowards(transform.rotation, q, speed * Time.deltaTime);
 
               If this is not what you are looking for, provide a more detailed description and/or a drawing.
Your answer