Blueprint Events to C++

BlueprintImplementableEvent

Add NotifyQuestActor to Grabber.h

UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void NotifyQuestActor(AActor* Actor);

You could now replace the BluePrint event with the C++ equivalent.

BlueprintNativeEvent

  1. In Blueprint rename TraceForPhysicsBodies to BP_TraceForPhysicsBodies

  2. In Grabber.h add UFUNCTION

Notice that the BP function returns 3 values. In C++ we’ll return 1 and use output parameters for the other 2.

../../_images/trace_for_physics_bodies_return.PNG
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
    bool TraceForPhysicsBodies(AActor*& HitActor, UPrimitiveComponent*& HitComponent);
  1. In Grabber.cpp add implementation, note the name has _Implementation as suffix

bool UGrabber::TraceForPhysicsBodies_Implementation(AActor*& HitActor, UPrimitiveComponent*& HitComponent)
{
        return false;
}
  1. Override TraceForPhysicsBodies in Blueprint:

../../_images/override_trace_for_physics_bodies.PNG
  1. Replace reference of BP_TraceForPhysicsBodies with TraceForPhysicsBodies and then delete BP_TraceForPhysicsBodies.