The values for FHitResult on the callback are all zeroes.
Also tried it with OnComponentOverlap… and had the same problem.
Header:
UPROPERTY(Category = Coll, BlueprintReadOnly, VisibleAnywhere)
USphereComponent *MySphereColl;
UFUNCTION()
void OnSphereCollHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
Constructor:
MySphereColl = CreateDefaultSubobject<USphereComponent>(TEXT("MySphereColl"));
MySphereColl->SetCollisionProfileName(TEXT("BlockAll"));
MySphereColl->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
MySphereColl->InitSphereRadius(35.0f);
MySphereColl->bGenerateOverlapEvents = true;
// Set the SphereComponent as the root component.
RootComponent = MySphereColl;
MySphereColl->OnComponentHit.AddDynamic(this, &ATestColl::OnSphereCollHit);
CALLBACK:
void ATestColl::OnSphereCollHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
DrawDebugSphere(GetWorld(), Hit.Location, 10.0f, 12, FColor::Red, false, 5.0f);
DrawDebugSphere(GetWorld(), Hit.ImpactPoint, 15.0f, 12, FColor::Blue, false, 5.0f);
}
Is that the expected behavior or are the values in FHitResult supposed to have something in them, and if so, should I report this as a bug?
Alternatively, how would I go about finding the intersection point on the sphere?