MATH: Change the rotation3d implementation to allow different rotation orders.
EMI: Fix attach and detach coordinates.
Pull changes from FixAttachDetach.