- Home /
 
               Question by 
               FirePhenix · Dec 21, 2011 at 06:42 PM · 
                transformrotatetranslateparenting  
              
 
              Parenting without transform.rotation
Hello. Tell me please, how to make the object to inherit transform.position, but did not inherit transform.rotation.
Sorry for my bad English.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Owen-Reynolds · Dec 21, 2011 at 11:12 PM
It inherits both position and rotation. You can't turn one off, so you're using code no matter what. In a case where you only want to "inherit" one, it seems easier to NOT child the object and move it my hand:
 public Transform P; // my "parent", but not really
 // alternate method#2:
 public Vector3 parOffset; // how far from parent to be
 void FixedUpdate() {
   // always 4 unit right of "parent":
   transform.position = P.position + P.right*4;
   // method#2:
   transform.position = P.position + P.TransformDirection(parOffset);
 }
The code more-or-less does the positioning step that Unity does for you on childing.
Your answer
 
 
             Follow this Question
Related Questions
can anyone tell me why this doesn't work? 1 Answer
Camera transform not responding after load 0 Answers
Parenting trigger moving platform 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                