I’m trying to spawn actor in game. For testing it is very simple:
HitLocation.ImpactPoint.Z += Height;
FTransform SpawnTM(FRotator(0, 0, 0), HitLocation.ImpactPoint);
ARPGProjectileSpawner* spawner = Cast<ARPGProjectileSpawner>(UGameplayStatics::BeginSpawningActorFromClass(PowerOwner, effectActor, SpawnTM));
if (spawner)
{
spawner->SetActorLocation(HitLocation.ImpactPoint);
spawner->SetActorRelativeLocation(HitLocation.ImpactPoint);
UGameplayStatics::FinishSpawningActor(spawner, SpawnTM);
}
}
It works, and actor spawn in correct position.
No in that spawned actor I try to get location:
FVector currentLocation = GetActorLocation();
DrawDebugSphere((), currentLocation, Radius, 32, FColor::Yellow, false, 10.0f);
And GetActorLocation() return 0 vector.