# Play Dynamic Forcefeedback C++

**URL:** <https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909>\
**Category:** C++\
**Tags:** force-feedback-effec, unreal-engine, CPP, question\
**Created:** [October 30, 2016, 9:14pm UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909 "2016-10-30T21:14:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![primacy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@primacy](https://forums.unrealengine.com/u/primacy)\
**Post date:** [October 30, 2016, 9:14pm UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909/1 "2016-10-30T21:14:02Z")

</div>

I am trying to play force feedback when I am pulling back on a string for my bow in c++ code but not exactly sure how to do so. Any suggestions ?

---

<div class="post-metadata">

**Author:** ![Katianie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Katianie](https://forums.unrealengine.com/u/Katianie)\
**Post date:** [February 27, 2017, 5:00am UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909/2 "2017-02-27T05:00:47Z")

</div>

bump, I am wondering too.

---

<div class="post-metadata">

**Author:** ![AnnKathrin\_Drews](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnnKathrin\_Drews](https://forums.unrealengine.com/u/AnnKathrin_Drews)\
**Post date:** [August 30, 2017, 11:44am UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909/3 "2017-08-30T11:44:33Z")

</div>

Going to answer this, because I was searching for an answer myself today and could not find any. Just in case anyone is still running into the same problem.

The solution should actually be quite straight forward. `PlayDynamicForceFeedback` is a public member of `PlayerController` so if you have access to your `PlayerController` you can just call `PlayDynamicForceFeedback` on it. Right?

```
FLatentActionInfo latentInfo;PlayerController->PlayDynamicForceFeedback(Intensity, Duration, bAffectsLeftLarge, bAffectsLeftSmall, bAffectsRightLarge, bAffectsRightSmall, EDynamicForceFeedbackAction::Start, latentInfo);
```

**NO** , you can **not JUST** call it. When you do it like this your dynamic force feedback is not processed. Which is very unexpected.

**But why?** I had to do some code digging to find this. Internally dynamic force feedback is added to the `LatentActionManager` as a latent action and will be destroyed by it without being processed if it had no callback target specified. Which is not documented anywhere where I would be searching when I am wondering why my dynamic force feedback is not being processed and I am all like “They certainly wouldn’t expect me to provide a CallbackTarget if I don’t even want to receive any callbacks.”

So what you actually need to do for the dynamic force feedback to be processed and not garbage collected is provide a `CallbackTarget` in your latentInfo and viola dynamic force feedback is playing.

```
FLatentActionInfo latentInfo;latentInfo.CallbackTarget = SomeUObjectThatIsNoNullPointer; // in my case I did not care about when the force feedback finishes so I just provided the PlayerController here, you can pass whatever you need to
PlayerController->PlayDynamicForceFeedback(Intensity, Duration, bAffectsLeftLarge, bAffectsLeftSmall, bAffectsRightLarge, bAffectsRightSmall, EDynamicForceFeedbackAction::Start, latentInfo);
```

---

<div class="post-metadata">

**Author:** ![AlexToucan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlexToucan](https://forums.unrealengine.com/u/AlexToucan)\
**Post date:** [July 24, 2018, 6:49pm UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909/4 "2018-07-24T18:49:32Z")

</div>

In the [blueprint documentation](https://api.unrealengine.com/INT/BlueprintAPI/Game/Feedback/PlayDynamicForceFeedback/index.html) it looks like the ‘Target’ is supposed to be the player. Not sure if it’s a one to one correlation between ‘Target’ and ‘CallbackTarget’.

---

<div class="post-metadata">

**Author:** ![AnnKathrin\_Drews](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnnKathrin\_Drews](https://forums.unrealengine.com/u/AnnKathrin_Drews)\
**Post date:** [July 25, 2018, 2:59pm UTC](https://forums.unrealengine.com/t/play-dynamic-forcefeedback-c/374909/5 "2018-07-25T14:59:16Z")

</div>

‘PlayDynamicForceFeedback’ is a member of APlayerController. The ‘Target’ for the blueprint node is the object ‘PlayDynamicForceFeedback’ is called on and there is no correlation between ‘Target’ and ‘CallbackTarget’ as ‘CallbackTarget’ is a member of ‘FLatentActionInfo’.

In blueprint you do not need to create the ‘FLatentActionInfo’ yourself, it is handled by what I call blueprint magic, which will also provide a ‘CallbackTarget’.
