How do you get the top left corner of a rotated vehicle in Unreal Engine 4?

You might find something a little closer to what you want, if you do, let me know, it might help me out too :slight_smile:

But, what I came up with is using the actual static mesh bounds, rather than the actor bounds, because the actor bounds are axis-aligned, and the static mesh bounds remain static:



FVector origin, extent;
actor->GetActorBounds(true, origin, extent); // to get the center of the entire thing

UStaticMeshComponent* staticMesh = Cast<UStaticMeshComponent>(actor->GetComponentByClass(UStaticMeshComponent::StaticClass());
FVector minBounds, maxBounds;
staticMesh->GetLocalBounds(minBounds, maxBounds); // gets the bounds of the static mesh on the actor -- if you have multiple visual components, or are not using a static mesh, you'll need to change this up

FRotator rotation = actor->GetActorRotation();
FVector forwardDirection, rightDirection, upDirection;
FRotationMatrix(rot).GetScaledAxes(forwardDirection, rightDirection, upDirection); // get direction vectors local to the item

FVector top = upDirection * maxBounds.Z * 0.5;
FVector right = rightDirection * maxBounds.Y;
FVector front = forwardDirection * maxBounds.X;

FVector topRightFront = origin + top + right + front;