- Home /
 
               Question by 
               MassiGamingRo · Apr 19, 2017 at 10:06 AM · 
                c#unity 5rotationgameobjecttransform  
              
 
              Transform a gameobject y rotation to another gameobject y rotation
I want the player to rotate when standing on an object that rotates.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by SohailBukhari · Apr 19, 2017 at 11:33 AM
You can simply assign Rotation of one object to other as:
- Make Two gameObjects. 
- Copy the eulerAngles Of one gameObject and save into local variable. 
- Rotate your Object x and z axis as it is and change Y which you save into your local variable as in the script. - public GameObject ObjA; public GameObject ObjB; private void Start() { var yRotation = ObjB.transform.eulerAngles.y; ObjA.transform.Rotate(ObjA.transform.eulerAngles.x, yRotation, ObjA.transform.eulerAngles.z); }
Your answer
 
 
             Follow this Question
Related Questions
C# 2d Always Rotate Facing Gameobject 1 Answer
Flip over an object (smooth transition) 3 Answers
Syncing Position and Rotation data in ECS tests? 0 Answers
How can I modify this rotation code to change how far the object rotates? 0 Answers
CharacterController.Move Not Corresponding to gameobject.transform.rotation 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                