Download

Kismet: How to use UKismetSystemLibrary::MoveComponentTo?

Hi,
I’m trying to move a camera to a new destination. In BluePrint using “Move Component To” it works. In C++ i get no errors, but nothing happens.

Here is my code:



APlayerController* current = GetWorld()->GetFirstPlayerController();
current->DisableInput(current);

auto* component = UserCamera->GetCameraComponent();
	
auto destinationLocation = DestinationCamera->GetActorLocation();
auto destinationRotation = DestinationCamera->GetActorRotation();

UKismetSystemLibrary::MoveComponentTo(
		component,
		destinationLocation,
		destinationRotation,
		true,
		true,
		2,
		EMoveComponentAction::Move,
		FLatentActionInfo());



Whats wrong in my code?

You should rather use SetComponentLocation .