Physics · class

DisjointExecutor

The premise, turned into something that fails.

Explained in Your first game, Rigid bodies.

class DisjointExecutor implements Executor
import { DisjointExecutor } from '@driftengine/physics';

In depth

A worker pool is safe here because two islands never write the same body, and that is an argument about four guards rather than a property anything checks. applyImpulse and applyLinear write only where invMass > 0; applyAngular writes only where the body is dynamic; integrateVelocities and integratePositions walk bodyOrder, which island.ts fills with dynamic indices alone. A static floor under two towers is read by both and written by neither.

One unguarded write to a static body would break the pool and nothing else. Serial physics would stay correct, every existing test would stay green, and the pool would produce a state that depends on which worker got there first — on some ticks, on some machines. That is a defect that ships green, so this character exists to make it a red test instead of a bug report.

It compares bits and not values, because the question is whether a write happened at all and -0 over 0 is a write. It needs no threads and no timing, so it cannot be flaky in either direction: the overlap it reports is a real one and its silence is a real absence.

A gate and not a character. Cost is one pass over every body per island, so a scene of a thousand singletons costs a million lane compares a tick. SerialExecutor remains the default.

Constructor

new

constructor(bodies: BodySet)
ParameterTypeDescription
bodiesBodySet

Properties

NameTypeDescription
overlapIslandOverlap | nullSet by run when two islands wrote one body. Null after a clean tick.

Methods

run

run(count: number, solver: IslandSolver): void
ParameterTypeDescription
countnumber
solverIslandSolver

Signatures

name = "disjoint"readonly

readonly name = "disjoint"