Constant Forces

A constant force is a force with a defined magnitude and duration.

You can apply an envelope to a constant force to give it shape. For example, suppose you have an effect with a nominal magnitude of 2,000 and a duration of 2 seconds. Then you apply an envelope with the following values:

Parameter Value
Attack time 0.5 second
Initial attack level 5,000
Fade time 1 second
Fade level 0

When you play the effect, you get the following:

Elapsed time Magnitude
0.0 5,000
0.1 4,400
0.2 3,800
0.3 3,200
0.4 2,600
0.5 2,000
(Duration of sustain) 2,000
1.0: 2,000
1.1 1,800
1.2 1,600
1.3 1,400
1.4 1,200
1.5 1,000
1.6 800
1.7 600
1.8 400
1.9 200
2.0 0

You cannot apply an offset to a constant force.

To create a constant force, pass GUID_ConstantForce to the IDirectInputDevice8::CreateEffect method. You can also pass any other globally unique identifier (GUID) obtained by the IDirectInputDevice8::EnumEffects method, provided the low byte of the dwEffType member of the DIEffectInfo structure (DIDFT_GETTYPE(dwEffType)) is equal to DIEFT_CONSTANTFORCE. In this way, you can use hardware-specific forces designed by the manufacturer such as a "constant" force that actually varies in magnitude in a seemingly random fashion to simulate turbulence.

A constant force uses a DICONSTANTFORCE structure to define the magnitude. A negative magnitude has the effect of reversing the direction of the force.