# Child object not rotating as parent

I have a FOV triangle as a child to a kind of homing missile. When it sees an enemy it is supposed to chase that enemy.

At instantiation the rotation is set to the powerup and starts out correctly.
However when I start moving on my 3D track where you could go any way the FOV keeps looking the same way even though the weapon keeps its correct path accross the track. The FOV keeps the correct position relative to the weapon.

In my FOV script

``````    void Update()
{
transform.position = parent.position;
transform.rotation = parent.rotation;
}
``````

This helps for the position, but not for the rotation.

Debugging the rotation tells me the object isn’t turning, yet it has to, to keep going on the track.

I use below code to keep the weapons to the track, which tells me the weapon should be rotating else it would go off into space…

``````        // stick the powerup to the track
if (distForward < distDown && distForward < distBack)
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(Vector3.Cross(transform.right, hitForward.normal), hitForward.normal), Time.deltaTime * 5.0f);
else if (distDown < distForward && distDown < distBack)
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(Vector3.Cross(transform.right, hitDown.normal), hitDown.normal), Time.deltaTime * 5.0f);
else if (distBack < distDown && distBack < distForward)
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(Vector3.Cross(transform.right, hitBack.normal), hitBack.normal), Time.deltaTime * 5.0f);

// apply gravity
if (distForward < Mathf.Infinity || distDown < Mathf.Infinity || distBack < Mathf.Infinity)
``````

So how to make sure the FOV triangle gets the rotation needed to keep looking forward relative to the weapon?

The child object IS rotating. The rotation shown in the inspector is rotation relative to the parent. The same goes for position and scale.

A child transform always moves and rotates with it’s parent transform. If the parent moves, the child moves as far in the same direction. If the parent rotates, all the children objects rotates around the parent, staying at the same relative position.

When you do this:

``````transform.position = parent.position;
transform.rotation = parent.rotation;
``````

You’re centering the child transform at the parent’s position, and giving it the same rotation as the parent - meaning that it’s local position and rotation should show as 0. On additional frames beyond the first one, your Update does nothing that’s not already happening.

If it helps to clarify, this Update function is identical to your Update:

``````void Update() {
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
}
``````