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?


  • \$\begingroup\$ 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? \$\endgroup\$
    – Nick Udell
    Aug 26, 2014 at 13:28


You must log in to answer this question.

Browse other questions tagged .