Get Location and Rotation inside Blueprint

I have a custom blueprint in c++ with a staticmeshcomponent as Input Parameter.
How can I get the current Position and Rotation of the static mesh?
I tried the following, but it doesn’t work.

bool UCustomBlueprintMovementLibrary::MoveByCSVFile(USceneComponent* component, FString csvName)
{
FVector currentPosition1 = (FVector)component->GetComponentLocation;
FRotator currentOrientation1 = (FRotator)component->GetComponentRotation;
currentPosition = (FVector)component->RelativeLocation;
currentOrientation = (FRotator)component->RelativeRotation;*/
return true;
}

UCLASS()
class ZWEIRADUMGEBUNG_API UCustomBlueprintMovementLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

		UFUNCTION(BlueprintCallable, meta = (name = "Move by CSV", CompactNodeTitle = "movebycsv"), Category = "Bike project nodes")
		static bool MoveByCSVFile(USceneComponent* component, FString csvName);	
};

What do you mean by “it doesn’t work”?

GetComponentLocation and GetComponentRotation are functions so you need to call them as follows:

 FVector currentPosition1 = component->GetComponentLocation();
 FRotator currentOrientation1 = component->GetComponentRotation();

No need to cast to FVector/FRotator as those are already the function signatures.

currentPosition = (FVector)component->RelativeLocation;
currentOrientation = (FRotator)component->RelativeRotation;

Here you also don’t need to cast, but what you’re essentially doing is setting two variable values which just goes out of scope as soon as the function is done.

If you want to set the component’s location and rotation you need to do the following:

FVector newPosition = ... // Not sure how you want to determine the new position
FRotator newRotation = ... // Not sure how you want to determine the new rotation

// Rather set the owning actor's location/rotation
component->GetOwner()->SetActorLocation(newPosition);
component->GetOwner()->SetActorRotation(newRotation);

Thank you for your answer…
That works for me, looks like I was just too stupid to get this :smiley: