C++ GetActorLocation() of Landscape

Hello,

I’m trying to get the actor location of my Landscape so that I can use it to know the size of my landscape.

I’m sure there’s a better way but I have the following that works to find the location of an actor which is setup in an actor component but I can’t figure out how to attach the actor component to the landscape:

void UMiningMaterialSpawn::DetermineMapSize()
{
	FVector ActorLocation = GetOwner()->GetActorLocation();
	UE_LOG(LogTemp, Warning, TEXT("Actor Location is: %s"), *ActorLocation.ToString());
}

Once I have this I’m assuming I can take Actor Location (-x)^2 to find my x dimension and the same for y. Then I can write something so that when I survey for materials I can get a percentage of concentration. This is a little down the road but if I can figure out the level size it would be a start.

Thank you!

Looks like I got it figured out:

void UMiningMaterialSpawn::DetermineMapSize()
{
	FVector ActorLocation = ActorSelection->GetActorLocation();
	UE_LOG(LogTemp, Warning, TEXT("Actor Location is: %s"), *ActorLocation.ToString());
}

From the public: Section of my Header file:

UPROPERTY(EditAnywhere)
AActor* ActorSelection;

After this, I selected the Landscape in the editor under ActorSelection in the component which is attached to an empty actor called MiningMineralSpawnActor.

Hope this helps anybody else looking.