invoke

operator fun Penetration?.invoke(onPenetration: (Penetration) -> Unit): Penetration?

Penetration? { onPenetration } => Penetration?
Runs onPenetration on the penetration when there is one, and returns the receiver unchanged either way.

The handler spelling for a penetration query's nullable answer: the trailing lambda hangs straight off the query, and the pass-through return keeps the answer live after the call — ?: behind it is an else-lane running only when there was no penetration, and a second trailing lambda handles the same penetration again. An exception thrown by onPenetration propagates unchanged. (subject collide collider) { penetration -> … } and (subject escape boundary) { penetration -> … } spell the call — the parentheses are part of the spelling: without them the lambda would attach to the query's right operand instead of its answer.

Receiver

The penetration query's answer to handle.

Return

This receiver: the penetration, or null when there was none.

Parameters

onPenetration

The handler, run once with the penetration when it exists.