Skip to content

Instantly share code, notes, and snippets.

@intaxwashere
Created November 19, 2022 05:24
Show Gist options
  • Save intaxwashere/829f49e43d4ad27534dd65e285926d8e to your computer and use it in GitHub Desktop.
Save intaxwashere/829f49e43d4ad27534dd65e285926d8e to your computer and use it in GitHub Desktop.
Macro versions of set world transform fast path from MassSample
// macro version of static function if performance is very very very critical and you want to ensure function will be inlined.
#define SET_WORLD_TRANSFORM_FAST(InComp, InTransform) \
InComp->SetComponentToWorld(InTransform); \
InComp->UpdateBounds(); \
\
InComp->MarkRenderTransformDirty(); \
for (auto Component : InComp->GetAttachChildren()) \
{ \
InTransform = Component->GetRelativeTransform() * InTransform; \
\
SetWorldTransformFastPathWithOverlaps(Component, InTransform); \
}
// macro version of static function if performance is very very very critical and you want to ensure function will be inlined.
#define SET_WORLD_TRANSFORM_FAST_WITH_OVERLAPS(InComp, InTransform) \
InComp->SetComponentToWorld(InTransform); \
InComp->UpdateBounds(); \
\
InComp->BodyInstance.SetBodyTransform(InTransform, ETeleportType::None); \
InComp->BodyInstance.UpdateBodyScale(InTransform.GetScale3D()); \
\
InComp->MarkRenderTransformDirty(); \
for (auto Component : InComp->GetAttachChildren()) \
{ \
InTransform = Component->GetRelativeTransform() * InTransform; \
\
SetWorldTransformFastPathWithOverlaps(Component, InTransform); \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment