I want 2 vectors representing the bounds of a mesh but when I rotate the actor, the bounds are wrong when the object rotates

I know it is old, but in case someone needs the answer:

void UYourClass::GetComponentOrientedBoundingBox(USceneComponent* Component, FVector& Origin, FVector& Extent)
{
	// Calculate the right world origin
	FVector ComponentExtent;
	float ComponentRadius;
	UKismetSystemLibrary::GetComponentBounds(Component, Origin, ComponentExtent, ComponentRadius);

	// Calculate the right extent
	auto Box = Component->GetOwner()->CalculateComponentsBoundingBoxInLocalSpace(); 
	Extent = Box.GetExtent();
}