Inserting a colision sphere to say a msg to the player

Hey there! I am going to provide a little bit of code that you can tweak to work for you. I’d also check to make sure the actors you are colliding with are set to work with Overlap Collisions.

I would go through your code but unfortunately I don’t have the time. So take mine instead and just double check the collisions. Cycle through the presets until it works. Also, try using GEngine->AddOnScreenDebugMessage to act as a check for you before calling your own functions. It’s a very reliable debug function. :slight_smile:

// 
// .h File
//

UPROPERTY(VisibleDefaultsOnly, Category = Projectile)
	class USphereComponent* CollisionComp;

	UFUNCTION()
		void OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);

/////////////////
////////////////

// .cpp File

void <YourClassNameHere>::OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	//GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::White, FString::FString(OtherComp->GetName()));
	//GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::White, FString::FString(OtherActor->GetName()));
}

AConstructorCharacter::AConstructorCharacter()
{
  	CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(100.0f);
	CollisionComp->BodyInstance.SetCollisionProfileName("Collision");
	CollisionComp->OnComponentBeginOverlap.AddDynamic(this, &AYourClassNameHere::OnOverlap);
	CollisionComp->bGenerateOverlapEvents = true;
	CollisionComp->AttachTo(RootComponent);
}