// The code actually running on the job public void Execute(int index) { int i = activeParticles[index]; // Project particles on the XY plane if we are in 2D mode: if (is2D) { // restrict position to the 2D plane float4 pos = positions[i]; pos[2] = previousPositions[i][2]; positions[i] = pos; // restrict rotation to the axis perpendicular to the 2D plane. quaternion swing, twist; BurstMath.SwingTwist(orientations[i], new float3(0, 0, 1), out swing, out twist); orientations[i] = twist; } if (inverseMasses[i] > 0) { velocities[i] = BurstIntegration.DifferentiateLinear(positions[i], previousPositions[i], deltaTime); } else { velocities[i] = float4.zero; } if (inverseRotationalMasses[i] > 0) { angularVelocities[i] = BurstIntegration.DifferentiateAngular(orientations[i], previousOrientations[i], deltaTime); } else { angularVelocities[i] = float4.zero; } }