예제 #1
0
            private void ProcessScale(ArchetypeChunk chunk, int firstEntityIndex)
            {
                var chunkEntities  = chunk.GetNativeArray(typeGroup.entity);
                var chunkColliders = chunk.GetNativeArray(typeGroup.collider);
                var chunkScales    = chunk.GetNativeArray(typeGroup.scale);

                for (int i = 0; i < chunk.Count; i++)
                {
                    var collider = Physics.ScaleCollider(chunkColliders[i], chunkScales[i]);
                    ProcessEntity(firstEntityIndex + i, chunkEntities[i], collider, RigidTransform.identity);
                }
            }
예제 #2
0
            private void ProcessTranslationScale(ArchetypeChunk chunk, int firstEntityIndex)
            {
                var chunkEntities     = chunk.GetNativeArray(typeGroup.entity);
                var chunkColliders    = chunk.GetNativeArray(typeGroup.collider);
                var chunkTranslations = chunk.GetNativeArray(typeGroup.translation);
                var chunkScales       = chunk.GetNativeArray(typeGroup.scale);

                for (int i = 0; i < chunk.Count; i++)
                {
                    var collider       = Physics.ScaleCollider(chunkColliders[i], chunkScales[i]);
                    var rigidTransform = new RigidTransform(quaternion.identity, chunkTranslations[i].Value);
                    ProcessEntity(firstEntityIndex + i, chunkEntities[i], collider, rigidTransform);
                }
            }
예제 #3
0
            private void ProcessParentScale(ArchetypeChunk chunk, int firstEntityIndex)
            {
                var chunkEntities      = chunk.GetNativeArray(typeGroup.entity);
                var chunkColliders     = chunk.GetNativeArray(typeGroup.collider);
                var chunkLocalToWorlds = chunk.GetNativeArray(typeGroup.localToWorld);
                var chunkScales        = chunk.GetNativeArray(typeGroup.scale);

                for (int i = 0; i < chunk.Count; i++)
                {
                    var localToWorld   = chunkLocalToWorlds[i];
                    var rotation       = quaternion.LookRotationSafe(localToWorld.Forward, localToWorld.Up);
                    var position       = localToWorld.Position;
                    var rigidTransform = new RigidTransform(rotation, position);
                    var collider       = Physics.ScaleCollider(chunkColliders[i], chunkScales[i]);
                    ProcessEntity(firstEntityIndex + i, chunkEntities[i], collider, rigidTransform);
                }
            }