RealDocs

UGameplayStatics::SpawnForceFeedbackAttached

function Engine Blueprint Since 4.12
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Spawns a UForceFeedbackComponent attached to a scene component so vibration is routed based on the moving component's position relative to local players. Useful for weapon recoil or vehicle vibration that must follow an actor.

Caveats & Gotchas

  • Like SpawnForceFeedbackAtLocation, this only affects local players — remote clients receive no feedback without a separate server-initiated call on their machine.
  • If bLooping is true and bAutoDestroy is true, the component will never be auto-destroyed while looping; you must hold the reference and call DestroyComponent() yourself.
  • bStopWhenAttachedToDestroyed defaults to false — a looping rumble can persist as an orphaned component after the parent actor is destroyed.

Signature

static ENGINE_API UForceFeedbackComponent* SpawnForceFeedbackAttached(UForceFeedbackEffect* ForceFeedbackEffect, USceneComponent* AttachToComponent, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), FRotator Rotation = FRotator::ZeroRotator, EAttachLocation::Type LocationType = EAttachLocation::KeepRelativeOffset, bool bStopWhenAttachedToDestroyed = false, bool bLooping = false, float IntensityMultiplier = 1.f, float StartTime = 0.f, class UForceFeedbackAttenuation* AttenuationSettings = nullptr, bool bAutoDestroy = true)

Parameters

Name Type Description Default
ForceFeedbackEffect UForceFeedbackEffect* The force feedback asset to play.
AttachToComponent USceneComponent* Component to attach the force feedback component to.
AttachPointName FName Optional socket or bone name to attach at. NAME_None
Location FVector Location offset relative to the attach point. FVector(ForceInit)
Rotation FRotator Rotation offset relative to the attach point. FRotator::ZeroRotator
LocationType EAttachLocation::Type Whether Location is relative or world-space. EAttachLocation::KeepRelativeOffset
bStopWhenAttachedToDestroyed bool Stop playback when the parent component is destroyed. false
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 class UForceFeedbackAttenuation* Optional attenuation settings to limit feedback by distance. nullptr
bAutoDestroy bool Automatically destroy the component when playback ends. true

Return Type

UForceFeedbackComponent*

Example

Attach continuous rumble to a vehicle chassis C++
RumbleComp = UGameplayStatics::SpawnForceFeedbackAttached(
	EngineRumbleEffect, GetRootComponent(),
	NAME_None, FVector::ZeroVector, FRotator::ZeroRotator,
	EAttachLocation::KeepRelativeOffset,
	true, true, 1.f, 0.f, nullptr, false);

Version History

Introduced in: 4.12

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.