- Home /
 
               Question by 
               SaniBerkovic · 4 days ago · 
                c#rotatelookatrotation axislookattarget  
              
 
              How to rotate towards a target but only on the y axis ?
This is rotating facing the target camFreeLook but also with the x and i want the transform to rotate only on the y. what should i cahnge/add to this working code so it will rotate only on the y ?
 private void Update()
 {
 transform.rotation = Quaternion.RotateTowards(transform.rotation,
     Quaternion.LookRotation(camfreelook.transform.position - transform.position),
     rotationSpeed * Time.deltaTime);
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                