Advertisement Jump to content


This topic is now archived and is closed to further replies.


Force Feedback question

This topic is 5485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a WingMan Force Joystick (Logitech). I tried to programatically use the force feedback of the joystick, but so far I only succeeded in assigning "non-triggered" effects to the joystick: DIEFFECT eef; ... eff.dwTriggerButton = DIEB_NOTRIGGER; eff.dwTriggerRepeatInterval = 0; ... This effect is played back whenever I start it. -- When I try to use the DirectInput tutorial code which uses a Triggered effect, this effect is _not_ played back, although I receive no error codes (HRESULT is OK). Do I have to manually call "start" on triggered effects? Could it be that my joystick does not support triggered effects? A solution that I see is that I "listen" for button triggers and manually call "start" upon receiving a button hit... But that can''t be a real solution, can it? Am I missing something? Thanks for your help! Beren

Share this post

Link to post
Share on other sites
I use the tutorial of the DirectX 9 documentation:
(guidEffect is one guid returned by enumerating the installed effects of the joystick. -- I also tried using a constant like GUID_ConstantForce or GUID_Sine; same result: HRESULT is ok, but nothing happens when I hit the button...)

LONG lDirection[2] = {0, 0};

DIPERIODIC diPeriodic;
DIENVELOPE diEnvelope;
DIEFFECT diEffect;

diPeriodic.dwMagnitude = DI_FFNOMINALMAX;
diPeriodic.lOffset = 0;
diPeriodic.dwPhase = 0;
diPeriodic.dwPeriod = (DWORD)(0.05 * DI_SECONDS);
diEnvelope.dwSize = sizeof(DIENVELOPE);
diEnvelope.dwAttackLevel = 0;
diEnvelope.dwAttackTime = (DWORD)(0.5 * DI_SECONDS);
diEnvelope.dwFadeLevel = 0;
diEnvelope.dwFadeTime = (DWORD)(1.0 * DI_SECONDS);
diEffect.dwSize = sizeof(DIEFFECT);
diEffect.dwDuration = (DWORD)(2 * DI_SECONDS);
diEffect.dwSamplePeriod = 0;
diEffect.dwGain = DI_FFNOMINALMAX;
diEffect.dwTriggerButton = DIJOFS_BUTTON0;
diEffect.dwTriggerRepeatInterval = 0;
diEffect.cAxes = 2;
diEffect.rgdwAxes = dwAxes;
diEffect.rglDirection = &lDirection[0];
diEffect.lpEnvelope = &diEnvelope;
diEffect.cbTypeSpecificParams = sizeof(diPeriodic);
diEffect.lpvTypeSpecificParams = &diPeriodic;

hr = g_lpDIDevice->CreateEffect(guidEffect, &diEffect, &g_lpdiEffect, NULL);

if (FAILED(hr)) {
return hr;

Share this post

Link to post
Share on other sites
I''ve tried both:

c_dfDIJoystick2 and c_dfDIJoystick --- both showed the same effect.

What exactly does "offset" mean?


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!