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); } }
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); } }
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); } }