Why does GetActorLocation().Z return 0.0 even though my actor is starting at 1500.0?

I am trying to track the Z location of my ball actor while in the scope of my paddle actor. I think it has to do something with the way I get the reference to my BallActor or the location methods/fields I am referencing must not be correct. In my editor the BallActor is set with it’s Z location to 1500.0f. So why does GetActorLocation().Z for my BallActor return 0.0?

void MyPaddle::BeginPlay()
{
	Super::BeginPlay();

	for (TActorIterator<AActor> ActorItr(GetWorld()); ActorItr; ++ActorItr) {
		if(ActorItr->GetActorClass() != NULL) {
			if (ActorItr->GetActorClass()->GetName().Equals("AOtherActor")){
				BallActor = ActorItr->GetClass()->GetDefaultObject<AOtherActor>();
			}
		}
	}
	
	
}

// Called every frame
void MyPaddle::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	
	if (GetActorLocation().Z < BallActor->GetActorLocation().Z ) {
		
		... code ...
	}
}

can you post code/screenshot that shows how your ball actor is set up?

what exactly are you looking for? I was able to call GetActorLocation in my BallActor class and it showed 1500.0f like I expected.

I would check that the BallActor you set in “BeginPlay” is the one you think it is, and that it’s valid. Names get mangled when you run the game (they get a suffix), so you might not be getting a match. Instead of ‘Equals’ you can try ‘Contains’. This page has some good alternatives to what you want to do: Can I find actors with name or tag at runtime? - Blueprint - Epic Developer Community Forums

I ended up using TOjbectIterator to iterate and find the ball actor. it works fine and the actor reference is correct.