First, I would use your calculations to determine the desired position of the front hips and the left rear hip. Then, I would use some vector math and Quaternion.LookRotation
to solve for the rotation:
Quaternion GetBodyRotation(Vector3 frontLeftLegWorldPosition,
Vector3 frontRightLegWorldPosition,
Vector3 rearLeftLegWorldPosition)
{
Vector3 localForward = frontLeftLegWorldPosition - rearLeftLegWorldPosition;
Vector3 localRight = frontRightLegWorldPosition - frontLeftLegWorldPosition;
Vector3 localUp = Vector3.Cross(localForward, localRight);
return Quaternion.LookRotation(localForward, localUp);
}
Then, I would apply that rotation to the body with bodyTransform.rotation = resultOfAboveMethod;
.
Then, assuming the left rear hip and front right hip are rotationally symmetrically positioned, you can set the position of the body such that it is in between the front right hip and left rear hip with bodyTransform.position = 0.5f * (frontRightLegWorldPosition + rearLeftLegWorldPosition);