Download

Trouble using PlayHapticEffect from C++

I’m trying to call this function:

void PlayHapticEffect
(
class UHapticFeedbackEffect_Base * HapticEffect,
EControllerHand Hand,
float Scale,
bool bLoop
)

To get the UHapticFeedbackEffect_Base*, I’m using FObjectFinder to get a haptic feedback curve:

static ConstructorHelpers::FObjectFinder<UHapticFeedbackEffect_Base> PickupEffect_Temp(TEXT("/Game/VirtualRealityBP/Blueprints/PickupFeedback"));
PickupEffect = PickupEffect_Temp.Object;

where PickupEffect is a UHapticFeedbackEffect_Base*

On compile, I get the error:
**
C2664 - void ConstructorHelpers::ValidateObject(UObject*, const FString &, const TCHAR )’: cannot convert argument 1 from 'UHapticFeedbackEffect_Base’ to ‘UObject*’**

Any ideas how I can successfully get the UHapticFeedbackEffect_Base in C++?

Not 100% on this but:



PickupEffect = Cast<UHapticFeedbackEffect_Base>(PickupEffect_Temp.Object);