how to initialize the existing mass representation processor to spawn requested actors ?…
void UControlProcessor::Execute(FMassEntityManager& EntityManager, FMassExecutionContext& Context){// Einfacher Zugriff - sucht nach ANY Subsystem, das das Interface implementiertUWorld* World = GetWorld();USceneBase* SceneBase = ULUtility::GetWorldSubsystem(World);if (SceneBase == nullptr)return;
uint32 CurrentSystemID = SceneBase->GetSystemId();
if (CurrentSystemID == 0)
return;
LastSystemID = CurrentSystemID;
EntityQuery.ForEachEntityChunk(Context, [SceneBase, CurrentSystemID](FMassExecutionContext& Context)
{
const int32 NumEntities = Context.GetNumEntities();
const TArrayView<FMassRepresentationLODFragment> PresentationLODFrags = Context.GetMutableFragmentView<FMassRepresentationLODFragment>();
const TArrayView<FMassRepresentationFragment> PresentationFrags = Context.GetMutableFragmentView<FMassRepresentationFragment>();
const TArrayView<const FSimulationFragment> SimulationFrags = Context.GetFragmentView<FSimulationFragment>();
const TArrayView<const FTransformFragment> TransformFrags = Context.GetFragmentView<FTransformFragment>();
for (int32 i = 0; i < NumEntities; ++i)
{
FMassRepresentationLODFragment& LodFragmen = PresentationLODFrags[i];
FMassRepresentationFragment& VisualFrag = PresentationFrags[i];
const FSimulationFragment& Simulation = SimulationFrags[i];
const FTransformFragment& Transform = TransformFrags[i];
const FMassEntityHandle& Entity = Context.GetEntity(i);
if (Simulation.SystemID == CurrentSystemID && LodFragmen.LOD != EMassLOD::High)
{
LodFragmen.LOD = EMassLOD::High;
LodFragmen.Visibility = EMassVisibility::CanBeSeen;
LodFragmen.LODSignificance = 0;
VisualFrag.HighResTemplateActorIndex = SceneBase->RetrieveActorIndex(Entity, Simulation.ID, Simulation.TypeID);
VisualFrag.LowResTemplateActorIndex = SceneBase->RetrieveActorIndex(Entity, Simulation.ID, Simulation.TypeID);
VisualFrag.PrevTransform = Transform.GetTransform();
}
if (Simulation.SystemID != CurrentSystemID && LodFragmen.LOD == EMassLOD::High)
{
LodFragmen.LOD = EMassLOD::Off;
VisualFrag.HighResTemplateActorIndex = -1;
VisualFrag.LowResTemplateActorIndex = -1;
VisualFrag.PrevTransform = Transform.GetTransform();
}
int32 xxx = 0;
}
});
}
how to enable the build in UMassRepresentationProcessor, properly
which fragments do i have to register on my archtype?
a minimalistic, working example would be great