# Rotating a parent so a child is facing a point.

Hello World,

I have a rocket turret that has a base, an arm, and a rocket. The base is the rockets yaw and the arm is the rockets pitch, but since the rocket sits at the end of the arm it lands off-set of what i point the arm at.

Is there away i can rotate the arm so the rocket lines up with the point.

The only thing i can think of is to measure the difference, in angles, between what the rocket is suppose to look at and what it is actually looking at, then add or subtract from the pitch.

``````        // point in front of the rocket
rocket_look_angle = Vector3.Angle(Rocket_Base_Launcher_Right.transform.position, Rocket_Base_Launcher_Right.transform.forward);
// point/crosshairs/target the rocket is suppose to look at
rocket_cross_angle = Vector3.Angle(Rocket_Base_Launcher_Right.transform.position, Mouse_Cam_Ply_Rot.crosshair.transform.position);

angle = rocket_look_angle - rocket_cross_angle;

if(angle > 0)
{
Rocket_Launcher_Pitch.transform.eulerAngles.x -= 1;
}
else if(angle < 0)
{
Rocket_Launcher_Pitch.transform.eulerAngles.x += 1;
}
``````

I’ve haven’t had any luck with this though so any help would be appreciated.

-Thanks

A screenshot would go a long way towards helping us understand what you are asking.

The center of the white box on the ground is the cross-hair the rockets are suppose to hit.

The arm/pitch is looking at the cross-hair but since the rocket launcher is off-set from the arm, the rockets land just off of the target.

the code I’m currently using is

``````	Rocket_Launcher_Yaw.transform.eulerAngles.y = Mouse_Cam_Ply_Rot.game_camera.transform.eulerAngles.y;
Rocket_Launcher_Pitch.transform.LookAt(Mouse_Cam_Ply_Rot.crosshair.transform);
``````

Hope it helps.