If rock size is less than 1, we don't spawn any more rocks
The for loop runs the spawning code inside the loop twice, once with offset set to -1, and once with offset set to 1.
Why it's clever: In 2D math, multiplying a direction vector by -1 flips it 180 degrees to point the exact opposite way. Looping over [-1, 1] lets us spawn two fragments flying in opposite directions using the exact same formula.
Direction is calculated as follows:
$Player.position.direction_to(pos): Draws an invisible straight line pointing from the player's ship to the exploding rock.
.orthogonal(): Rotates that line by 90 degrees (perpendicular). This ensures the new rocks split sideways relative to your line of fire rather than flying straight back into your ship's face.
* offset: Sends the first rock left (* -1) and the second rock right (* 1) along that perpendicular line.
Position is calculated as follows:
Pushes each new fragment's starting position out to the opposite edges of the parent rock.
Why it matters: If both new rocks spawned at the exact center (pos), their collision shapes would overlap on frame 1, causing the physics engine to violently fling them apart. Multiplying dir * radius places them cleanly side-by-side without touching.
Velocity is calculated as follows:
vel.length() extracts the raw speed (a single number) of the parent rock before it died.
Multiplying by 1.1 gives the fragments a 10% speed boost, making smaller debris move slightly faster than large asteroids to ramp up the arcade tension.
Multiplying by dir applies that boosted speed along the new sideways trajectory.