question: protected void addChildTo ( ModelRenderer child , ModelRenderer parent ) { float distance = ( float ) Math . sqrt ( Math . pow ( ( child . rotationPointZ - parent . rotationPointZ ) , 2 ) + Math . pow ( ( child . rotationPointY - parent . rotationPointY ) , 2 ) ) ; float oldRotateAngleX = parent . rotateAngleX ; float parentToChildAngle = ( float ) Math . atan ( ( child . rotationPointZ - parent . rotationPointZ ) / ( child . rotationPointY - parent . rotationPointY ) ) ; float childRelativeRotation = parentToChildAngle - parent . rotateAngleX ; float newRotationPointY = ( float ) ( distance * ( Math . cos ( childRelativeRotation ) ) ) ; float newRotationPointZ = ( float ) ( distance * ( Math . sin ( childRelativeRotation ) ) ) ; parent . rotateAngleX = 0F ; child . setRotationPoint ( child . rotationPointX - parent . rotationPointX , newRotationPointY , newRotationPointZ ) ; parent . addChild ( child ) ; parent . rotateAngleX = oldRotateAngleX ; child . rotateAngleX -= parent . rotateAngleX ; child . rotateAngleY -= parent . rotateAngleY ; child . rotateAngleZ -= parent . rotateAngleZ ; }
target:  Calculates the relative positions and rotations easily. <p/> Note: When parenting a chain of boxes, such as a head to a neck to a body, the end of the chain should start first. In this case the head should be parented to the neck before parenting the neck to the body. <p/> Some corrections and adjustments to the rotation point may be needed.