My Actor in Unreal Engine isn't moving when i call the "SetActorLocation()"

In Unreal 5.2.1 im trying to set an Actors Position every tick to a Scene Components Position, but i cant seem to get it to work, i feel like this should be simple but im not figuring it out.

void UTriggerComponent::TickComponent(float DeltaTime, ELevelTick TickType,
    FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
    
    AActor* Actor = GetAcceptableActor();
    if (Actor != nullptr)
    {
        Actor->DisableComponentsSimulatePhysics();
        FVector Location = SceneComponent->GetComponentLocation();
        Actor->SetActorLocation(Location);
        shouldMove = true;
        Mover->SetShouldMove(true);
    }
    else
    {
        Mover->SetShouldMove(false);
    }
    
}

Here is also the code to my “GetAcceptableActor()” Function;

AActor* UTriggerComponent::GetAcceptableActor() const
{
    TArray<AActor*> Actors;
    GetOverlappingActors(Actors);
    
    for (AActor* Actor : Actors)
    {
        if (Actor->ActorHasTag(TagName))
        {
            return Actor;
        }
    }
    
    return nullptr;
}

My SceneComponent Variable is something declared in the header file and i use a getter thats called in C++ and Blueprint to get the correct SceneComponent.

I know for sure that

  • I am using the correct SceneComponent
  • I am also getting the correct actor because it is disabling physics successfully

I have tried

  • Changing the SetActorLocation to, LocationAndRotation, Transform, and Separate
  • Finding for example WorldTransform/WorldLocation
  • Instead of Getting GetComponentLocation() getting GetComponentToWorld()

Have you tried adding logs to see where it’s going wrong?

Privacy & Terms