Platform SDK: DirectX |
The DICONDITION type describes parameters for a force-feedback condition in the DIEFFECT type.
Type DICONDITION lDeadBand As Long lNegativeCoefficient As Long lNegativeSaturation As Long lOffset As Long lPositiveCoefficient As Long lPositiveSaturation As Long End Type
If the device does not support separate positive and negative coefficients, then the value of lNegativeCoefficient is ignored and the value of lPositiveCoefficient is used as both the positive and negative coefficients.
If the device does not support force saturations, then the value of this member is ignored.
If the device does not support separate positive and negative saturations, then the value of lNegativeSaturation is ignored and the value of lPositiveSaturation is used as both the positive and negative saturations.
If the device does not support force saturation, then the value of this member is ignored.
Different types of conditions will interpret the parameters differently, but the basic idea is that force resulting from a condition is equal to A(q - q0) where A is a scaling coefficient, q is some metric, and q0 is the neutral value for that metric.
The preceding simplified formula must be adjusted if a nonzero dead band is provided. If the metric is less than lOffset - lDeadBand, then the resulting force is given by the following formula:
force = lNegativeCoefficient * (q - (lOffset - lDeadBand))
Similarly, if the metric is greater than lOffset + lDeadBand, then the resulting force is given by the following formula:
force = lPositiveCoefficient * (q - (lOffset + lDeadBand))
A spring condition uses axis position as the metric.
A damper condition uses axis velocity as the metric.
An inertia condition uses axis acceleration as the metric.