Well, it has no offset. The image below shows that there is no difference between the actor location and the static mesh component location.
#if !(UE_BUILD_SHIPPING || UE_BUILD_SHIPPING_WITH_EDITOR) DrawDebugSphere(
[INDENT=2]GetWorld(),
NextLocation,
5,
2,
FColor::White,
false,
3.f,
0,
2.f[/INDENT]
);
if(TempArr[Index]->GetClass() == UStaticMeshComponent::StaticClass())
{
[INDENT=2]UStaticMeshComponent* StaticMeshComp = Cast<UStaticMeshComponent>(TempArr[Index]);[/INDENT]
[INDENT=2]
FBox BoundingBox = StaticMeshComp->GetStaticMesh()->GetBounds().GetBox();[/INDENT]
[INDENT=2]
FVector ComponentLocation = StaticMeshComp->GetComponentTransform().GetLocation();[/INDENT]
[INDENT=2]FVector BoundsCenter;
FVector BoundsExtents;
BoundingBox.GetCenterAndExtents(BoundsCenter, BoundsExtents);
FString CenterComparison = "OUTPUT: ActorCenter(";
CenterComparison += FString::Printf(TEXT("%f, "), NextLocation.X);
CenterComparison += FString::Printf(TEXT("%f, "), NextLocation.Y);
CenterComparison += FString::Printf(TEXT("%f) "), NextLocation.Z);
CenterComparison += "ComponentCenter(";
CenterComparison += FString::Printf(TEXT("%f, "), ComponentLocation.X);
CenterComparison += FString::Printf(TEXT("%f, "), ComponentLocation.Y);
CenterComparison += FString::Printf(TEXT("%f) "), ComponentLocation.Z);
CenterComparison += "BoundsCenter(";
CenterComparison += FString::Printf(TEXT("%f, "), BoundsCenter.X);
CenterComparison += FString::Printf(TEXT("%f, "), BoundsCenter.Y);
CenterComparison += FString::Printf(TEXT("%f) "), BoundsCenter.Z);
CenterComparison += "BoundsExtents(";
CenterComparison += FString::Printf(TEXT("%f, "), BoundsExtents.X);
CenterComparison += FString::Printf(TEXT("%f, "), BoundsExtents.Y);
CenterComparison += FString::Printf(TEXT("%f) "), BoundsExtents.Z);
UE_LOG(LogTemp, Warning, TEXT("%s"), *CenterComparison);
DrawDebugBox([/INDENT]
[INDENT=3]GetWorld(),
StaticMeshComp->GetComponentTransform().GetLocation(),
BoundingBox.GetExtent(),
StaticMeshComp->GetComponentTransform().GetRotation(),
FColor::Green,
false,
.03f,
0,
2.f[/INDENT]
[INDENT=2]);[/INDENT]
}
#endif
https://imgur.com/a/sVSoIM0
Imo, I have an ordering conflict related to execution of the instructions inside my Tick(): the DrawDebugBox related to the bounds of a static mesh (that is moving, I’m not using physics btw) is being drawn before the static mesh reachs its destination, and the DrawDebugBox call is made after the SetActorLocation call.
Yesterday, I looked for a way to guarantee that the renderer only would be able to draw the DebugBox after the actor movement. I could use a loop, but I don’t want to halt the execution until a condition returns true, or a Timer (to be triggered after a time window lesser than DeltaTime (?)).
So I have looked the FFunctionGraphTask::CreateAndDispatchWhenReady (and FSimpleDelegateGraphTask::CreateAndDispatchWhenReady too), the Async call (https://docs.unrealengine.com/en-US/…ync/index.html) and FAsyncTask, but I don’t think FAsyncTask is the best option here, since I don’t have to process a big chunk of data (to split its processing between threads )…
Is there a better solution to do this? Again, the DrawDebugBox execution happens before the SetActorLocation call, even calling it after the SetActorLocation instruction… :S