How to make a projectile push player?

Hi, i had same problem, i found a solution that i think can be considered accepted given few options:

i created following blueprint structure:

341025-capture.png

c++ code for above is:

ADrawer::ADrawer() {
	PrimaryActorTick.bCanEverTick = true;

	rootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("rootSceneComponent"));
	rootSceneComponent->SetupAttachment(RootComponent);

	staticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("staticMeshComponent"));
	staticMeshComponent->SetupAttachment(rootSceneComponent);

	boxComponent = CreateDefaultSubobject<UBoxComponent>(TEXT("boxComponent"));
	boxComponent->SetupAttachment(staticMeshComponent);
}

then in BeginPlay function i calculate bounding box volumes ir orden to avoiding doing it manually:

FVector min, , center;
staticMeshComponent->GetLocalBounds(min, );
center =  - min;
boxComponent->SetRelativeLocation(min + center/2);
boxComponent->SetBoxExtent(center/2);

and then finally in Tick function i make following calculation before and after updating object (drawer) location:

location = boxComponent->GetComponentLocation();

// put here code that updates you object location

deltaLocation = location - boxComponent->GetComponentLocation();
TSet<AActor*> set;
boxComponent->GetOverlappingActors(set, AMyCharacter::StaticClass());
if (set.Num() > 0) {
	UE_LOG(LogTemp, Warning, TEXT("set = %d"), set.Num());
	AMyCharacter* character = Cast<AMyCharacter>(set[FSetElementId::FromInteger(0)]);
	character->AddActorWorldOffset(-deltaLocation);
}

Hope it helps…