Jump to content
  • Advertisement

Archived

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

Beren77

Force Feedback question

This topic is 5240 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
Advertisement
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...)


DWORD dwAxes[2] = {DIJOFS_X, DIJOFS_Y};
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.dwFlags = DIEFF_POLAR | DIEFF_OBJECTOFFSETS;
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;

LPDIRECTINPUTEFFECT g_lpdiEffect;
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?

Thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!