Its possible to speed this up yes. without knowing much about what bottleneck you are hitting, you could likely be running into child component transforms needing to be updated. At any rate a simple list of items:
- Avoid calling these things: Instead of using that->SetWorldLocation(that->GetWorldLocation() + Offset), first check that Offset is not zero or that the GetWorldLocation does not match what you are setting it to. ( I would’nt suggest getting the location every time however ). Also specific to this example, use AddWorldOffset. When you call these functions its likely that all child scene components that are relative to it are updated before the return of SetXLocation / Rotation.
- Take number 1 and applie it to the pair of rotation and location, if you determine both need to be set use SetComponentTransform instead. I’m unsure if the implementation of these optimize for that case on all component types but it can be assumed they should if they do not already.
- Take a look at documentation for FScopedMovementUpdate
- If you’re still having issues, tinker with the idea of detaching components and reattaching them later.
I’m still getting into the engine, so someone may have more specific advice.