Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Can I ask my parent to move according to the child axis? This means if I turn right, then right again, the parent has to be at 180° from its original position, and not only at 90° (because "Right" would mean : "stay on the right axis from the parent axis", and what I want is : "move the parent according to the child axis").

The parent has a script to move, and the child has the script to rotate, so I would need to use the new rotation from the child, and not the rotation from the parent.

My attempt so far is this one : in "MoveBody()", oldTr = transform.position works without a bug, but it is using the parent axis. With oldTr = this_objW;, there is a bug, the parent goes somewhere in the scene and move its "z" axis in an odd way :

this_obj = GameObject.Find("this_obj").transform;//the child to rotate
this_objW = this_obj.TransformDirection(this_obj.forward);//world


MoveBody( new Vector3( 3.0f, 0, 0 ) );


private void MoveBody( Vector3 vec ){

      Debug.Log("transform.position : "+transform.position+" / this_objW : "+this_objW); //same value here: Vector3(0,0,1);
      oldTr = this_objW; //transform.position;
      newTr = this_objW;//transform.position;
      newTr += vec;
      transform.position = Vector3.MoveTowards(oldTr, newTr, sideSpeed * Time.deltaTime);

Is it possible to do it this way? Or should I translate each axis by hand?


share|improve this question
Why do you need to do this? Why not apply the rotation script to the parent? What is the intended behaviour if your parent has multiple children? – Nick Udell Aug 26 '14 at 13:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.