UGameplayStatics::SpawnForceFeedbackAtLocation
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Spawns a UForceFeedbackComponent at a world location and begins playback, routing vibration to controllers whose players are within the attenuation range. Replication is not handled.
Caveats & Gotchas
- • Force feedback only reaches controllers that belong to local players; remote clients in a multiplayer game will not feel the effect unless it is triggered on their machine separately.
- • Without an AttenuationSettings asset, the feedback affects all local players regardless of distance — pass an attenuation asset to limit it to nearby players.
- • Returns nullptr on platforms that do not support force feedback (e.g. PC keyboard/mouse); null-check before calling methods on the result.
Signature
static ENGINE_API UForceFeedbackComponent* SpawnForceFeedbackAtLocation(const UObject* WorldContextObject, UForceFeedbackEffect* ForceFeedbackEffect, FVector Location, FRotator Rotation = FRotator::ZeroRotator, bool bLooping = false, float IntensityMultiplier = 1.f, float StartTime = 0.f, UForceFeedbackAttenuation* AttenuationSettings = nullptr, bool bAutoDestroy = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to obtain the world context. | — |
| ForceFeedbackEffect | UForceFeedbackEffect* | The force feedback asset to play. | — |
| Location | FVector | World-space position of the effect source. | — |
| Rotation | FRotator | Orientation of the effect source. | FRotator::ZeroRotator |
| bLooping | bool | Whether the effect loops indefinitely. | false |
| IntensityMultiplier | float | Scalar multiplier applied to the effect intensity. | 1.f |
| StartTime | float | Offset in seconds into the effect to begin playback. | 0.f |
| AttenuationSettings | UForceFeedbackAttenuation* | Optional attenuation settings to limit the effect by distance from the player. | nullptr |
| bAutoDestroy | bool | Automatically destroy the component when playback ends. | true |
Return Type
UForceFeedbackComponent* Example
Rumble controllers near an explosion C++
UGameplayStatics::SpawnForceFeedbackAtLocation(
this, ExplosionRumble, ExplosionLocation,
FRotator::ZeroRotator, false, 1.f, 0.f, RumbleAttenuation); Tags
Version History
Introduced in: 4.12
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?