public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var curPos = chunk.GetNativeArray(curPositionType); var pos = chunk.GetNativeArray(positionType); var entity = chunk.GetNativeArray(entityType); // FIXME: use a memcopy since size and layout must be identical for (int ent = 0; ent < curPos.Length; ++ent) { var cp = pos[ent]; curPos[ent] = new CurrentSimulatedPosition { Value = cp.Value }; commandBuffer.AddComponent(chunkIndex, entity[ent], new PreviousSimulatedPosition { Value = cp.Value }); } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { // For all chunks where trans has changed since start of simulation // Copy trans to currentTrans if (ChangeVersionUtility.DidChange(chunk.GetComponentVersion(positionType), simStartComponentVersion)) { // Transform was interpolated by the rendering system var curPos = chunk.GetNativeArray(curPositionType); var pos = chunk.GetNativeArray(positionType); // FIXME: use a memcopy since size and layout must be identical for (int ent = 0; ent < curPos.Length; ++ent) { curPos[ent] = new CurrentSimulatedPosition { Value = pos[ent].Value }; } } }