Download

Xbox Pad Vibration/Rumble (Force Feedback)

Hey

I’m hoping somebody can help me out here. I’m not having a lot of luck making either a Xbox360 or Xbox1 controller vibrate (attached to a Windows PC). Either pad can be used to control the game just fine.

I’ve tried two methods, neither to success, both in Debug and Development builds. Using Unreal Editor v4.5.1. My code is hit and stepping through I can see no obvious problems with my calls (no early outs in engine code). I have noticed that my breakpoint at the start of FActiveForceFeedbackEffect::Update() is not being hit, implying I’m not activating the effects properly.

Using APlayerController::PlayDynamicForceFeedback()



FLatentActionInfo actionInfo; // should this be filled out? If so, what with!
APlayerController* pLocalPC = GEngine->GetFirstLocalPlayerController(GetWorld());
pLocalPC->PlayDynamicForceFeedback(1.f, -1.f, true, true, true, true, EDynamicForceFeedbackAction::Start, actionInfo);


This should cause the controller to vibrate at maximum until I tell it otherwise. Result: nothing. :frowning:

Using APlayerController::ClientPlayForceFeedback()



FName nameSurface = "SurfaceRumble"; // does this matter? I just made this up here
APlayerController* pLocalPC = GEngine->GetFirstLocalPlayerController(GetWorld());
pLocalPC->ClientPlayForceFeedback(pFFBEffect, true, nameSurface);


This should play pFFBEffect, which is a valid pointer to a UForceFeedbackEffect blueprint, which contains an intensity curve lasting 2 seconds (not that duration should be important since it is set to loop until stopped), on ALL motors. Result: nothing. :frowning:

Digging around in the Unreal docs doesn’t seem to actually give a working example. Hoping somebody here has some experience and is willing to enlighten me as to my oversight.

Thanks!

I never managed to get Force Feedback working with anything Blueprint, though, ShooterGame has a Force Feedback effect that works IIRC!

Thanks, I’ve downloaded the ShooterGame example and have breakpointed the call to ClientPlayForceFeedback() when the weapon is fired. It gets hit every time I pull the trigger, yet I feel nothing. The pad vibrates for a second or two when I plug it in. Is this fundametenally broken?

As a test, I complied and ran the RumbleController sample project from the DirectX SDK. All functioning OK there. Are there any other settings in Unreal, perhaps, that could disable this functionality if not setup correctly?

I’ve never actually figured this out, is it a driver issue? Like does the PC driver support controller rumble?

Have you tried with the blueprint function?

See this: https://answers.unrealengine.com/questions/99288/controller-rumblevibration.html

I’ve created blueprints for the static effects, yes, without success. I need the dynamic method to work as well anyway, in order to achieve what I want.

I have established why the effects to not work in the ShooterGame demo; the effect that plays when you fire the weapon is set to only spin the right large motor. In XInputInterface::SendControllerEvents(), only right small and left large are actually fed to the controller, since that is all the Microsoft hardware has. Cheers Epic!

Having altered the FFE_Fire blueprint to use large left, I get rumble! So now to debug my own game and see what’s failing, as this is using the same call that I am. I’ll let you know what I find.

So the problem for static force feedback effects was rather simple in the end; we are using a derived version of APlayerController::PlayerTick() which was not calling the base class, nor was it calling ProcessForceFeedback(). Adding in the latter call got static effects working. Thanks to TheJamsh for the tip about ShooterGame, being able to debug that as a reference was really useful.

This leaves me to understand why dynamic effects are still not working. I suspect I need to fill out a valid latent action but I don’t understand what this is, least how to fill it out. Anyone have any suggestions?

To conclude my solution, I gave up trying to use PlayDynamicForceFeedback(), and wrote my own derived version of APlayerController::ProcessForceFeedback() that reads in an extra struct, allowing me to operate the two motors independently, and update the values with a simple set function that takes two floats. Simples!

I still don’t understand why the solution in the engine appears so unnecessarily convoluted. Would be interested to know but it’s no longer stopping me from achieving what I want. Thanks all for your comments.

Hi…
I’m searching to for a tutorial or at least a way to using phone vibration … do you have any suggestion ?
thanks