- Home /
 
               Question by 
               ikelaiah · Jun 19, 2013 at 12:28 AM · 
                rotationquaternioneulerangles  
              
 
              Matching 2 axes rotation only of 2 gameobjects
I am matching rotation of 2 gameobject around y and z axis. In the update function, I have the following
 transform.rotation.eulerAngles.y = roverPlatform.transform.rotation.eulerAngles.y;
 transform.rotation.eulerAngles.z = roverPlatform.transform.rotation.eulerAngles.z;
Is there a more neat / elegant approach to this task?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by ikelaiah · Jul 04, 2013 at 12:10 AM
A suggestion from a friend of mine from UK, Arvind. I might put the solution here in case anyone needs it.
 function LateUdate() {
     transform.rotation = Quaternion.Euler(0.0f, target.transform.rotation.eulerAngles.y,  target.transform.rotation.eulerAnges.z);
 }
Why late update? Making sure the parent will move first before update the other object. A suggested here by aldonatello.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                