protected override void OnUpdate() { var settings = GetSingleton <SpawnerSettings>(); var centerEntity = _focusGroup.GetSingletonEntity(); //var focusTranslation = EntityManager.GetComponentData<Translation>(focusEntity); //var ccComponentType = GetArchetypeChunkComponentType<CharacterControllerComponentData>(); //var translationType = GetArchetypeChunkComponentType<Translation>(); //var rotationType = GetArchetypeChunkComponentType<Rotation>(); var segment = math.radians((float)137.51); //float radius = settings.Radius; for (var i = 0; i < settings.NumCubes; i++) { var radius = 1.3f * math.sqrt(i); var cubeEntity = EntityManager.Instantiate(settings.Prefab); float3 pos = new float3(0, 0, 0) + new float3( radius * math.sin(i * segment + Time.deltaTime) * math.cos(0), radius * math.sin(0) * math.sin(i * segment + Time.deltaTime), radius * math.cos(i * segment + Time.deltaTime)); EntityManager.SetComponentData(cubeEntity, new Translation { Value = pos }); EntityManager.AddComponentData(cubeEntity, new RotationData { Value = 2, }); // The child translation is happening automatically when the entity in the center is rotated. // It can only work because each cube has the centerEntity as parent, // ECS internally updates all the child the positions automatically. EntityManager.AddComponentData(cubeEntity, new Parent { Value = centerEntity }); EntityManager.AddComponentData(cubeEntity, new LocalToParent { Value = float4x4.identity }); } Enabled = false; }