I want to create a Projectile and therefore I was trying around with collision events. I created a very simple c++ class just with a SphereComponent and an overlap function
the .h
/** sphere component */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Projectile Components")
USphereComponent* Sphere1;
void OnOverlapBegin(class AActor* OtherActor);
the .cpp
ATOEProjectile::ATOEProjectile()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Sphere1 = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere1"));
Sphere1->InitSphereRadius(250.0f);
RootComponent = Sphere1;
OnActorBeginOverlap.AddDynamic(this, &ATOEProjectile::OnOverlapBegin);
}
void ATOEProjectile::OnOverlapBegin(class AActor* OtherActor)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("This is an on screen message!"));
}
I created a blueprint of it an simply move it by SetActorLocation(). When it collides with an other Actor ( a simple Box) nothing happens. But when I use the ActorBeginOverlap of the blueprinted class i get feedback.
I also tried this in 4.10.2 and got the same result. Am I doing somehting wrong here?