In MotionBuilder, the global translation, rotation, and scale matrices of a model are all computed separately. These matrix computations follow a particular order as explained in the following sections. The M suffix is used to denote matrices, and the V suffix is used to identify vectors.
The local (LocalRotationM) and global (GlobalRotationM) rotation matrices are calculated as follows. The matrix operations are applied from right to left.
(1) RotationDoFM = KRotationM · JRotationM · IRotationM
The IRotationM, JRotationM, and KRotationM matrices describe the amount of rotation around each local axis depending on the model's rotation order (FBModel.RotationOrder). For example, if the model's rotation order is set to Euler ZYX (FBModelRotationOrder.kFBEulerZYX), the amount of rotation is as follows:
(2) LocalRotationM = PreRotationM · RotationDoFM · PostRotationM-1
Where, PostRotationM-1 denotes the inverse of the PostRotationM matrix.
(3) GlobalRotationM = ParentGlobalRotationM · LocalRotationM
Where, the ParentGlobalRotationM matrix is the parent FBModel's GlobalRotationM matrix. The resulting local rotation matrix (LocalRotationM) is used in the following global scale and translation matrix computations.
The computation of an FBModel's global scale matrix (GlobalScaleM) depends on the scale inherit type of its parent.
Parent's Scaling Inherit Type | Description |
---|---|
Local (RrSs) | Activates the local scaling mode. If you scale a parent object on its X, Y, or Z axis, the child objects scale on their local X, Y, or Z axis. The child objects also translate to keep proportional distance from the parent. You can still scale the child object without affecting the parent. |
Parent (RSrs) | Activates the parent scaling mode. If you scale a parent object on one axis, the child objects deform to maintain their volume while stretching to scale on the same axis. For example, you can use this option if you have a group of models and you want them all to scale down on the same axis and appear squashed. |
Scale Compensate | In this mode, the child objects do not inherit scaling from the parent objects at all. When a parent object is scaled, the child does not scale, but translates to keep the proportional distance between the models. |
The result of this computation is a vector (GlobalScaleV), so that no shear is induced.
(4a) GlobalScaleV = ParentGlobalScaleV · LocalScaleV
The global translation vector and matrix of an FBModel is computed as follows using LocalScaleM.
(5) ScalePivotTranslationV = (I - LocalScaleM) · ScalePivotV + ScalePivotOffsetV Where I is the identity matrix. (6) ScaleAndRotatePivotTranslationV = (LocalRotationM · (ScalePivotTranslationV - RotationPivotV)) + RotationPivotV + RotationPivotOffsetV (7) LocalTranslationV = TranslationDoFV + RotatePivotTranslationV (8) GlobalTranslationV = ParentGlobalTransformationM · LocalTranslationV
The global transformation matrix of an FBModel makes use of the computed global translation, rotation, and scaling matrices.
(9) GlobalTransformationMatrix = GlobalTranslationM · GlobalRotationM · GlobalScaleM