?/TD>
Microsoft DirectX 9.0

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:

ParameterValue
Attack time0.5 second
Initial attack level5,000
Fade time1 second
Fade level0

When you play the effect, you get the following:

Elapsed timeMagnitude
0.05,000
0.14,400
0.23,800
0.33,200
0.42,600
0.52,000
(Duration of sustain)2,000
1.0:2,000
1.11,800
1.21,600
1.31,400
1.41,200
1.51,000
1.6800
1.7600
1.8400
1.9200
2.00

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 (DIEFT_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.



© 2002 Microsoft Corporation. All rights reserved.