How do I make a soldier aim at a target?

I have been making a FPS game and I want the enemies to be able to aim up and down much like how Y3llow Mustang’s marine AI does.

eg.

I have searched all around for a solution and I can’t quite find one.

Most games do this by offsetting the angle of the RootJoint, and inversely rotating the joints of the legs.