The absolute (CTRL_ABSOLUTE
) and relative (CTRL_RELATIVE
) options are used by both Control::GetValue()
and Control::SetValue()
in a similar way.
Control::GetValue()
CTRL_RELATIVE
means that we're passing in a data structure which already contains a value and the controller is supposed to modify that value. In the case of position, rotation, scale, and TM controllers, this structure is a matrix. Note that not all controllers work in this way. A Lookat constraint, for example, ignores the incoming transform, because the desired world orientation is independent of the incoming orientation.CTRL_ABSOLUTE
indicates that we want the absolute value directly from the controller.Control::SetValue()
CTRL_ABSOLUTE
indicates that the given value should completely replace the current value in the controller.CTRL_RELATIVE
indicates that the given value should be 'added' to the current value. For data types which operate in a multiplicative space (rotation and scale) 'added' means 'multiply'.In the example of a position controller, CTRL_RELATIVE
indicates that the val
pointer passed in points to a matrix. Typically the position controller would then pre-multiply in its translation however the controller could modify the matrix in other ways. For example the path controller overwrites the translation portion of the matrix instead of pre-multiplying.
One other important issue is that rotation controllers expect different data types depending on whether Control::GetValue()
or Control::SetValue()
are called with CTRL_ABSOLUTE
or CTRL_RELATIVE
. In the CTRL_RELATIVE
case, an angle/axis structure is used, and in the CTRL_ABSOLUTE
case a quaternion is used. This allows for multiple revolutions to be tracked by the controller (which would have been lost if the angle/axis was converted to a quaternion).