Get center of actor in world coordinates instead of local coordinates

I’m calculating the center of an actor, but the FVector I get is in local coordinates. I need to get it in world coordinates so that I can move the center of the actor where I need it to go in the world. Code I use to get the center and my not working attempt at getting the center in world coordinates:

/// Get center of actor
const FVector BoundsPointMapping[8] =
{
	FVector(1, 1, 1),
	FVector(1, 1, -1),
	FVector(1, -1, 1),
	FVector(1, -1, -1),
	FVector(-1, 1, 1),
	FVector(-1, 1, -1),
	FVector(-1, -1, 1),
	FVector(-1, -1, -1)
};        
const FBox EachActorBounds = HitResultComponent->GetOwner()->GetComponentsBoundingBox(true); 
const FVector BoxCenter = EachActorBounds.GetCenter();

/// Get center in world coordinates (doesn't work)
FIntVector IntWorldOffset = HitResult.GetActor()->GetWorld()->OriginLocation;
FVector WorldOffset = FVector(IntWorldOffset.X, IntWorldOffset.Y, IntWorldOffset.Z);
FVector CenterInWorld = WorldOffset + BoxCenter; ///World offset
PhysicsHandle->GrabComponent(HitResultComponent, FName(), CenterInWorld, true);

From what I’ve read you can use the FTransform to switch between local and world. It seems FTransform::TransformPosition() will give you the world position and FTransform::InverseTransformPosition() will give you local position.

I haven’t tested it though and can’t right now, but you should try it if you can get your actor’s transform.

I tried the replacing my world offset code above with this, but it did not work either. I can’t find any good examples of translating local to world coordinates for some reason…

		FTransform* Tranformer = new FTransform();
		UInstancedStaticMeshComponent* HitMesh = NewObject<UInstancedStaticMeshComponent>(HitResult.GetActor());
		HitMesh->GetInstanceTransform(0, *Tranformer, true);
		MeshCenter = Tranformer->TransformPosition(MeshCenter);