Simple Raytrace distance = 0

I’ve written a function which raytraces directly downwards from the VR camera (to detect if the player is currently ducking), but the distance is returning 0 in the log.

I’ve avoided self- collision with AddIgnoredActor(this), and I can’t detect what the raytrace is hitting.

Attempting to print out the name of the actor/component that gets hit in the log results in a crash (most likely because nullptr).

	// Ray Casting downwards from the HMD
	FHitResult* hitResult = new FHitResult();
	FVector hmdLocation = CameraComp->GetComponentLocation();
	FVector endTrace = hmdLocation + (FVector(0.0f, 0.0f, -90.0f) * 50.0f);
	FCollisionQueryParams traceHmdDistanceParams = FCollisionQueryParams(FName("HMD Duck Raycast"), true, this);
	traceHmdDistanceParams.AddIgnoredActor(this); 	// Ignore ourselves in the collision detection
	GetWorld()->LineTraceSingleByChannel(*hitResult, hmdLocation, endTrace, ECC_WorldStatic, traceHmdDistanceParams); // Start Raycast
	
	// Show HMD raycasts in the world
	DrawDebugLine(GetWorld(), hmdLocation, endTrace, FColor::Red, true);

	if (hitResult->Distance <= duckingHeight)
	{
		UE_LOG(LogTemp, Warning, TEXT("Player HIT actor / Distance to ground: %f"), hitResult->Distance);
	}

Bit stuck here, any help appreciated.

Fixed. Multiple issues, the floor Static Mesh didn’t have collision so the trace wasn’t hitting anything. I’ve simplified the function also: https://i.imgur.com/H0knBxY.png