Well, the default dynamic occlusion occludes everything that is not rendered, if it were a skeletal mesh, the same but if you want to occlude animations there is an option for that.
I copied some lines of code from UMovementComponent
From a function called.
ShouldSkipUpdate(float DeltaTime)
It seems to work.
bool AMyActor::ShouldSkipUpdate(float DeltaTime) const
{
if (!IsValid(StaticMesh))
{
return true;
}
if (IsNetMode(NM_DedicatedServer))
{
// Dedicated servers never render
return true;
}
if (StaticMesh->Mobility != EComponentMobility::Movable)
{
return true;
}
const float RenderTimeThreshold = 0.41f;
UWorld* TheWorld = GetWorld();
if (TheWorld->TimeSince(StaticMesh->GetLastRenderTime()) <= RenderTimeThreshold)
{
return false; // Rendered, don't skip it.
}
return true;
}
This is definitely a problem with replication of the movement because it is an actor that applies damage.
If it does not move on the dedicated server the client and server will have different positions
So the problem now is. If it doesn’t render on the client, it must not move on the server…
Another problem is that the Tick function is not disabled (it just doesn’t move when not rendering). So this is consuming CPU time anyway and the ideally is disable it completely.