2D physics functions and components
import { Capsule2D, Chain2D, PhysicsDebug2D, PhysicsShape2D, PhysicsWorld2D, Segment2D, circleShape2D, collider2D, pibblPhysicsBody2D, pibblPhysicsWorld2D, dynamicBody2D,} from "@pibbl/core/physics/2d";@pibbl/core/physics/2d is a component-scoped, Pibbl-scheduled Rapier 2D world. It
does not start a second animation loop. For recipes and interaction examples,
read the 2D physics guide. Pure construction and
geometry operations are also exported by @pibbl/core/physics/2d/geometry.
The central contracts are
PibblPhysicsWorld2DProps,
PibblPhysicsBodyHandle2D, and
PibblPhysicsShape2D.
World and Canvas primitives
Section titled “World and Canvas primitives”PhysicsWorld2D
Section titled “PhysicsWorld2D”const world = ( <PhysicsWorld2D gravity={[0, 600]} fixedStepMilliseconds={1000 / 60} />);Creates one world for descendants. It owns fixed-step simulation, collision
delivery, presentation interpolation, and teardown. Default space="root"
uses root-logical coordinates; creation-only space="local" follows the
world’s viewport transform. See
PibblPhysicsWorld2DProps.
pibblPhysicsWorld2D
Section titled “pibblPhysicsWorld2D”function pibblPhysicsWorld2D(): PibblPhysicsWorldHandle2D;Returns the nearest world while a descendant evaluates. Use it for world queries, coordinate conversion, and inspection.
PhysicsShape2D, Capsule2D, Segment2D, and Chain2D
Section titled “PhysicsShape2D, Capsule2D, Segment2D, and Chain2D”Canvas primitives that paint exact supported shapes and accept physics:
const primitiveShapes = ( <> <PhysicsShape2D style={{ shape: circleShape2D({ radius: 8 }) }} /> <Capsule2D style={{ start: [0, 0], end: [36, 0], radius: 5 }} /> <Segment2D style={{ start: [0, 0], end: [60, 0] }} /> <Chain2D style={{ points: [ [0, 0], [40, 0], [40, 24], ], radius: 2, }} /> </>);Their props and styles are covered by the 2D physics types.
PhysicsDebug2D
Section titled “PhysicsDebug2D”const debug = ( <PhysicsDebug2D world={pibblPhysicsWorld2D()} color="rgba(0, 160, 255, .8)" />);Renders a read-only diagnostic overlay of committed collider bounds, centers of mass, contact points, and contact normals. It creates no pointer targets, does not advance the world, and is appropriate for tests and development-only scenes.
withPhysicsShape2D
Section titled “withPhysicsShape2D”function withPhysicsShape2D<P, I, ResolvedStyle>( component: PibblPrimitiveComponent<P, I>, options: { resolveShape(style: Readonly<ResolvedStyle>): PibblPhysicsShape2D },): PibblPrimitiveComponent< P & PibblPhysicsPrimitiveProps2D, I & { physics?: PibblPhysicsAttachment2D }>;Derives a primitive that resolves an immutable shape synchronously from its resolved style. This is the custom-primitive extension point; it does not mount a world or alter paint order.
Descriptor and handle factories
Section titled “Descriptor and handle factories”function dynamicBody2D( options?: PibblPhysicsDynamicBody2DOptions,): PibblPhysicsBodyAttachment2D;function staticBody2D( options?: PibblPhysicsStaticBody2DOptions,): PibblPhysicsBodyAttachment2D;function kinematicBody2D( options?: PibblPhysicsKinematicBody2DOptions,): PibblPhysicsBodyAttachment2D;function collider2D( options?: PibblPhysicsColliderConfiguration2D,): PibblPhysicsColliderAttachment2D;function pibblPhysicsBody2D(): PibblPhysicsBodyHandle2D;Attach a body descriptor to a primitive and child collider2D() descriptors to
its geometry. Dynamic bodies receive forces and contacts; static bodies remain
fixed; kinematic bodies follow declared signals and affect other bodies. The
body primitive’s authored transform supplies its initial pose. pibblPhysicsBody2D
is a stable hook handle that can bind to one live body at a time.
Commands
Section titled “Commands”Commands enter Pibbl’s Begin phase and take effect on the next admitted physics frame; none mutate a world during render.
function applyForce2D( body: PibblPhysicsBodyHandle2D, force: PibblPhysicsVector2, options?: { at?: PibblPhysicsVector2; wake?: boolean },): void;function applyImpulse2D( body: PibblPhysicsBodyHandle2D, impulse: PibblPhysicsVector2, options?: { at?: PibblPhysicsVector2; wake?: boolean },): void;function applyTorque2D(body: PibblPhysicsBodyHandle2D, torque: number): void;function setLinearVelocity2D( body: PibblPhysicsBodyHandle2D, velocity: PibblPhysicsVector2,): void;function setAngularVelocity2D( body: PibblPhysicsBodyHandle2D, degreesPerSecond: number,): void;function teleportBody2D( body: PibblPhysicsBodyHandle2D, pose: PibblPhysicsPose2D,): void;function wakeBody2D(body: PibblPhysicsBodyHandle2D): void;function sleepBody2D(body: PibblPhysicsBodyHandle2D): void;function disableBody2D(body: PibblPhysicsBodyHandle2D): void;function enableBody2D( body: PibblPhysicsBodyHandle2D, options?: { velocity?: "zero" | "preserve" },): void;at is a world-space application point. Teleportation sets a pose without a
sweep. Re-enabling uses zero velocity unless preserve is selected.
Mounted-world queries and observation
Section titled “Mounted-world queries and observation”function raycastAny2D( world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D,): boolean;function raycastClosest2D( world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D,): PibblPhysicsQueryHit2D | null;function raycastAll2D( world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D,): readonly PibblPhysicsQueryHit2D[];function shapeCastAny2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): boolean;function shapeCastClosest2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): PibblPhysicsQueryHit2D | null;function shapeCastAll2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): readonly PibblPhysicsQueryHit2D[];function hasShapeOverlap2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D,): boolean;function findShapeOverlap2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D,): PibblPhysicsQueryMatch2D | null;function findAllShapeOverlaps2D( world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D,): readonly PibblPhysicsQueryMatch2D[];function hasAabbMatch2D( world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D,): boolean;function findAabbMatch2D( world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D,): PibblPhysicsQueryMatch2D | null;function findAllAabbMatches2D( world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D,): readonly PibblPhysicsQueryMatch2D[];function hasPointMatch2D( world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): boolean;function findPointMatch2D( world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): PibblPhysicsQueryMatch2D | null;function findAllPointMatches2D( world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D,): readonly PibblPhysicsQueryMatch2D[];function toPhysicsPoint2D( world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2,): PibblPhysicsVector2;function fromPhysicsPoint2D( world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2,): PibblPhysicsVector2;function inspectPhysics2D( world: PibblPhysicsWorldHandle2D,): PibblPhysicsInspection2D;function inspectPhysics2D( body: PibblPhysicsBodyHandle2D,): PibblPhysicsBodyInspection2D | undefined;Queries read the committed world and accept filtering options. Each named operation returns a
fixed boolean, nullable record, or readonly array contract. The point helpers cross
between root-logical and simulation coordinates. inspectPhysics2D(world)
returns an immutable JSON-safe world observation without advancing, restoring,
or scheduling. inspectPhysics2D(body) returns only that body’s observation;
an unbound or stale handle returns undefined.
Pure shapes and geometry
Section titled “Pure shapes and geometry”circleShape2D, ellipseShape2D, boxShape2D, roundedBoxShape2D,
capsuleShape2D, arcShape2D, wedgeShape2D, segmentShape2D,
chainShape2D, and polygonShape2D each create an immutable
PibblPhysicsShape2D from their
corresponding option object.
function boundsOfShape2D(shape: PibblPhysicsShape2D): PibblPhysicsAabb2D;function massProperties2D( shape: PibblPhysicsShape2D, density?: number,): PibblPhysicsMassProperties2D;function transformShape2D( shape: PibblPhysicsShape2D, transform: PibblPhysicsTransform2D,): PibblPhysicsShape2D;function containsPoint2D( shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, point: PibblPhysicsVector2,): boolean;function distanceBetweenShapes2D( first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D,): PibblPhysicsDistance2D;function overlapShapes2D( first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D,): boolean;function contactBetweenShapes2D( first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D,): PibblPhysicsShapeContact2D | null;function raycastShape2D( shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, ray: PibblPhysicsRay2D, options?: { includeInitialOverlap?: boolean },): PibblPhysicsShapeHit2D | null;function shapeCastAgainstShape2D( moving: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, target: PibblPhysicsShape2D, targetPose: PibblPhysicsPose2D, options?: { includeInitialOverlap?: boolean },): PibblPhysicsShapeHit2D | null;These deterministic functions need neither a mounted world nor Pibbl core.
transformShape2D returns a new descriptor. Contact normals point from the
second shape toward the first.
Fixed query return contracts
Section titled “Fixed query return contracts”| Query | Boolean | One result or null |
Readonly result array |
|---|---|---|---|
| raycast | raycastAny2D |
raycastClosest2D |
raycastAll2D |
| shapeCast | shapeCastAny2D |
shapeCastClosest2D |
shapeCastAll2D |
| overlapShape | hasShapeOverlap2D |
findShapeOverlap2D |
findAllShapeOverlaps2D |
| queryAabb | hasAabbMatch2D |
findAabbMatch2D |
findAllAabbMatches2D |
| queryPoint | hasPointMatch2D |
findPointMatch2D |
findAllPointMatches2D |
All functions accept PibblPhysicsQueryOptions2D for sensor policy, collision
filtering, and exclusions. There is no mode option. Boolean queries stop at
the first match. Cast results sort by time of impact, distance, then collider
index and generation. Overlap, bounds, and point results sort by collider index
and generation; find… returns the first in that order, not a nearest match.
Returned result arrays are frozen; no matches produce false, null, or an
empty array according to the named operation.
API details from source
Section titled “API details from source”
arcShape2D
Section titled “arcShape2D”Creates an immutable arc collision shape without initializing a physics world.
arcShape2D: (input: Readonly<{ center?: PibblPhysicsVector2; radius: number; startAngleRadians: number; endAngleRadians: number; counterclockwise?: boolean; thickness: number; }>) => PibblPhysicsShape2DRelated API: arcShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Arc center, radius, angular endpoints in radians, sweep direction, and thickness. See PibblPhysicsVector2 .
Returns
Section titled “Returns”An immutable thick-arc collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:232
boundsOfShape2D
Section titled “boundsOfShape2D”Computes axis-aligned bounds for an immutable shape at an optional pose.
boundsOfShape2D: (shape: PibblPhysicsShape2D, pose?: PibblPhysicsPose2D) => PibblPhysicsAabb2DRelated API: boundsOfShape2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsAabb2D.
Parameters
Section titled “Parameters”-
shape— Shape whose bounds are needed. See PibblPhysicsShape2D. -
pose— Optional pose at which to evaluate the shape. See PibblPhysicsPose2D.
Returns
Section titled “Returns”Axis-aligned bounds of the posed shape. See PibblPhysicsAabb2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:391
boxShape2D
Section titled “boxShape2D”Creates an immutable box collision shape without initializing a physics world.
boxShape2D: (input: Readonly<{ width: number; height: number; center?: PibblPhysicsVector2; }>) => PibblPhysicsShape2DRelated API: boxShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Box width, height, and optional center. See PibblPhysicsVector2.
Returns
Section titled “Returns”An immutable box collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:107
capsuleShape2D
Section titled “capsuleShape2D”Creates an immutable capsule collision shape without initializing a physics world.
capsuleShape2D: (input: Readonly<{ start: PibblPhysicsVector2; end: PibblPhysicsVector2; radius: number; }>) => PibblPhysicsShape2DRelated API: capsuleShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Capsule centerline endpoints and radius. See PibblPhysicsVector2.
Returns
Section titled “Returns”An immutable capsule collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:199
chainShape2D
Section titled “chainShape2D”Creates an immutable chain collision shape without initializing a physics world.
chainShape2D: (input: Readonly<{ points: readonly PibblPhysicsVector2[]; closed?: boolean; radius?: number; }>) => PibblPhysicsShape2DRelated API: chainShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Ordered chain points, closure policy, and optional radius. See PibblPhysicsVector2 .
Returns
Section titled “Returns”An immutable chain collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:337
circleShape2D
Section titled “circleShape2D”Creates an immutable circle collision shape without initializing a physics world.
circleShape2D: (input: Readonly<{ radius: number; center?: PibblPhysicsVector2; }>) => PibblPhysicsShape2DRelated API: circleShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Circle radius and optional center. See PibblPhysicsVector2.
Returns
Section titled “Returns”An immutable circle collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:49
ellipseShape2D
Section titled “ellipseShape2D”Creates an immutable ellipse collision shape without initializing a physics world.
ellipseShape2D: (input: Readonly<{ radiusX: number; radiusY: number; center?: PibblPhysicsVector2; rotationDegrees?: number; }>) => PibblPhysicsShape2DRelated API: ellipseShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Ellipse radii, optional center, and rotation in degrees. See PibblPhysicsVector2 .
Returns
Section titled “Returns”An immutable ellipse collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:74
massProperties2D
Section titled “massProperties2D”Computes shape area, centroid, mass, and rotational inertia at the requested density.
massProperties2D: (shape: PibblPhysicsShape2D, options?: Readonly<{ density?: number; }>) => PibblPhysicsMassProperties2DRelated API: massProperties2D, PibblPhysicsShape2D, PibblPhysicsMassProperties2D.
Parameters
Section titled “Parameters”-
shape— Shape whose mass properties are needed. See PibblPhysicsShape2D. -
options— Optional material density.
Returns
Section titled “Returns”Mass, center of mass, and inertia for the shape. See PibblPhysicsMassProperties2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:411
polygonShape2D
Section titled “polygonShape2D”Creates an immutable polygon collision shape without initializing a physics world.
polygonShape2D: (input: Readonly<{ points: readonly PibblPhysicsVector2[]; }>) => PibblPhysicsShape2DRelated API: polygonShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Ordered polygon vertices. See PibblPhysicsVector2.
Returns
Section titled “Returns”An immutable polygon collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:363
roundedBoxShape2D
Section titled “roundedBoxShape2D”Creates an immutable rounded box collision shape without initializing a physics world.
roundedBoxShape2D: (input: Readonly<{ width: number; height: number; radius: number | readonly [topLeft: number, topRight: number, bottomRight: number, bottomLeft: number]; center?: PibblPhysicsVector2; }>) => PibblPhysicsShape2DRelated API: roundedBoxShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Box dimensions, center, and uniform or per-corner radii. See PibblPhysicsVector2 .
Returns
Section titled “Returns”An immutable rounded-box collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:137
segmentShape2D
Section titled “segmentShape2D”Creates an immutable segment collision shape without initializing a physics world.
segmentShape2D: (input: Readonly<{ start: PibblPhysicsVector2; end: PibblPhysicsVector2; }>) => PibblPhysicsShape2DRelated API: segmentShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Segment endpoints. See PibblPhysicsVector2.
Returns
Section titled “Returns”An immutable line-segment collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:313
transformShape2D
Section titled “transformShape2D”Returns independent shape geometry transformed by a rigid 2D pose.
transformShape2D: (shape: PibblPhysicsShape2D, transform: PibblPhysicsTransform2D) => PibblPhysicsShape2DRelated API: transformShape2D, PibblPhysicsShape2D, PibblPhysicsTransform2D.
Parameters
Section titled “Parameters”-
shape— Source shape; it is not modified. See PibblPhysicsShape2D. -
transform— Transform to apply to the shape. See PibblPhysicsTransform2D.
Returns
Section titled “Returns”A shape containing the transformed geometry. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:446
wedgeShape2D
Section titled “wedgeShape2D”Creates an immutable wedge collision shape without initializing a physics world.
wedgeShape2D: (input: Readonly<{ center?: PibblPhysicsVector2; radius: number; startAngleRadians: number; endAngleRadians: number; counterclockwise?: boolean; }>) => PibblPhysicsShape2DRelated API: wedgeShape2D, PibblPhysicsVector2, PibblPhysicsShape2D.
Parameters
Section titled “Parameters”input— Wedge center, radius, angular endpoints in radians, and sweep direction. See PibblPhysicsVector2 .
Returns
Section titled “Returns”An immutable wedge collision shape. See PibblPhysicsShape2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/shapes.ts:263
containsPoint2D
Section titled “containsPoint2D”Tests whether a point lies within a posed shape without creating a physics world.
containsPoint2D: (shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, point: PibblPhysicsVector2) => booleanRelated API: containsPoint2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
shape— Shape to test. See PibblPhysicsShape2D. -
pose— Shape pose. See PibblPhysicsPose2D. -
point— Point in the same coordinate space as the posed shape. See PibblPhysicsVector2 .
Returns
Section titled “Returns”Whether the posed shape contains the point.
See also
Section titled “See also”View source — packages/core/src/features/physics/2d-geometry.ts:209
distanceBetweenShapes2D
Section titled “distanceBetweenShapes2D”Computes signed separation and witness geometry between two posed shapes.
distanceBetweenShapes2D: (first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D) => PibblPhysicsDistance2DRelated API: distanceBetweenShapes2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsDistance2D.
Parameters
Section titled “Parameters”-
first— First shape. See PibblPhysicsShape2D. -
firstPose— Pose of the first shape. See PibblPhysicsPose2D. -
second— Second shape. See PibblPhysicsShape2D. -
secondPose— Pose of the second shape. See PibblPhysicsPose2D.
Returns
Section titled “Returns”Distance and closest-point information for the two posed shapes. See PibblPhysicsDistance2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/2d-geometry.ts:231
overlapShapes2D
Section titled “overlapShapes2D”Tests whether two posed shapes overlap without creating a physics world.
overlapShapes2D: (first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D) => booleanRelated API: overlapShapes2D, PibblPhysicsShape2D, PibblPhysicsPose2D.
Parameters
Section titled “Parameters”-
first— First shape. See PibblPhysicsShape2D. -
firstPose— Pose of the first shape. See PibblPhysicsPose2D. -
second— Second shape. See PibblPhysicsShape2D. -
secondPose— Pose of the second shape. See PibblPhysicsPose2D.
Returns
Section titled “Returns”Whether the two posed shapes overlap.
See also
Section titled “See also”View source — packages/core/src/features/physics/2d-geometry.ts:252
contactBetweenShapes2D
Section titled “contactBetweenShapes2D”Computes contact geometry for two posed shapes, or null when they do not contact.
contactBetweenShapes2D: (first: PibblPhysicsShape2D, firstPose: PibblPhysicsPose2D, second: PibblPhysicsShape2D, secondPose: PibblPhysicsPose2D) => PibblPhysicsShapeContact2D | nullRelated API: contactBetweenShapes2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsShapeContact2D.
Parameters
Section titled “Parameters”-
first— First shape. See PibblPhysicsShape2D. -
firstPose— Pose of the first shape. See PibblPhysicsPose2D. -
second— Second shape. See PibblPhysicsShape2D. -
secondPose— Pose of the second shape. See PibblPhysicsPose2D.
Returns
Section titled “Returns”Contact information, or null when the shapes do not contact. See PibblPhysicsShapeContact2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/2d-geometry.ts:275
raycastShape2D
Section titled “raycastShape2D”Casts a ray against one posed shape and returns its first hit or null.
raycastShape2D: (shape: PibblPhysicsShape2D, publicPose: PibblPhysicsPose2D, ray: PibblPhysicsRay2D, options?: Readonly<{ includeInitialOverlap?: boolean; }>) => PibblPhysicsShapeHit2D | nullRelated API: raycastShape2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsRay2D, PibblPhysicsShapeHit2D.
Parameters
Section titled “Parameters”-
shape— Shape to intersect. See PibblPhysicsShape2D. -
publicPose— Target shape pose. See PibblPhysicsPose2D. -
ray— Ray origin, direction, and travel limit. See PibblPhysicsRay2D. -
options— Whether initial overlap counts as a hit.
Returns
Section titled “Returns”The first shape hit, or null when there is no hit. See PibblPhysicsShapeHit2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/collision/casts.ts:68
shapeCastAgainstShape2D
Section titled “shapeCastAgainstShape2D”Sweeps a posed shape along a translation against another posed shape and returns a hit or null.
shapeCastAgainstShape2D: (moving: PibblPhysicsShape2D, publicFrom: PibblPhysicsPose2D, publicTranslation: PibblPhysicsVector2, target: PibblPhysicsShape2D, publicTargetPose: PibblPhysicsPose2D, options?: Readonly<{ includeInitialOverlap?: boolean; }>) => PibblPhysicsShapeHit2D | nullRelated API: shapeCastAgainstShape2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsVector2, PibblPhysicsShapeHit2D.
Parameters
Section titled “Parameters”-
moving— Shape to sweep. See PibblPhysicsShape2D. -
publicFrom— Initial pose of the moving shape. See PibblPhysicsPose2D. -
publicTranslation— Translation vector for the sweep. See PibblPhysicsVector2. -
target— Stationary shape to test against. See PibblPhysicsShape2D. -
publicTargetPose— Pose of the stationary shape. See PibblPhysicsPose2D. -
options— Whether initial overlap counts as a hit.
Returns
Section titled “Returns”The first sweep hit, or null when there is no hit. See PibblPhysicsShapeHit2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/collision/casts.ts:150
PhysicsWorld2D
Section titled “PhysicsWorld2D”Owns one transparent, component-scoped 2D physics world.
PhysicsWorld2D: PibblComponent<PibblPhysicsWorld2DProps>Related API: PhysicsWorld2D, PibblComponent, PibblPhysicsWorld2DProps.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/world-component.ts:48
PhysicsShape2D
Section titled “PhysicsShape2D”Draws an immutable physics shape as a Canvas primitive with optional body or collider attachment.
PhysicsShape2D: PibblPrimitiveComponent<PhysicsShape2DProps, PrimitiveInput<PhysicsShape2DProps, PhysicsShape2DStyle>>Related API: PhysicsShape2D, PibblPrimitiveComponent, PhysicsShape2DProps, PrimitiveInput, PhysicsShape2DStyle.
Parameters
Section titled “Parameters”props— Authored component inputs, supplied through JSX or createElement. See the linked props and style types.
Throws
Section titled “Throws”When called directly; Pibbl mounts this component through JSX or createElement.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/components.ts:79
Capsule2D
Section titled “Capsule2D”Draws a capsule between two endpoints with optional physics attachment.
Capsule2D: PibblPrimitiveComponent<Capsule2DProps, PrimitiveInput<Capsule2DProps, Capsule2DStyle>>Related API: Capsule2D, PibblPrimitiveComponent, Capsule2DProps, PrimitiveInput, Capsule2DStyle.
Parameters
Section titled “Parameters”props— Authored component inputs, supplied through JSX or createElement. See the linked props and style types.
Throws
Section titled “Throws”When called directly; Pibbl mounts this component through JSX or createElement.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/components.ts:96
Segment2D
Section titled “Segment2D”Draws a line segment with optional physics attachment.
Segment2D: PibblPrimitiveComponent<Segment2DProps, PrimitiveInput<Segment2DProps, Segment2DStyle>>Related API: Segment2D, PibblPrimitiveComponent, Segment2DProps, PrimitiveInput, Segment2DStyle.
Parameters
Section titled “Parameters”props— Authored component inputs, supplied through JSX or createElement. See the linked props and style types.
Throws
Section titled “Throws”When called directly; Pibbl mounts this component through JSX or createElement.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/components.ts:118
Chain2D
Section titled “Chain2D”Draws an open or closed point chain with optional physics attachment.
Chain2D: PibblPrimitiveComponent<Chain2DProps, PrimitiveInput<Chain2DProps, Chain2DStyle>>Related API: Chain2D, PibblPrimitiveComponent, Chain2DProps, PrimitiveInput, Chain2DStyle.
Parameters
Section titled “Parameters”props— Authored component inputs, supplied through JSX or createElement. See the linked props and style types.
Throws
Section titled “Throws”When called directly; Pibbl mounts this component through JSX or createElement.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/components.ts:139
collider2D
Section titled “collider2D”Creates a declarative collider attachment for a primitive within a physics body.
collider2D: (options?: PibblPhysicsColliderConfiguration2D) => PibblPhysicsColliderAttachment2DRelated API: collider2D, PibblPhysicsColliderConfiguration2D, PibblPhysicsColliderAttachment2D.
Parameters
Section titled “Parameters”options— Collider shape, material, filtering, and sensor configuration. See PibblPhysicsColliderConfiguration2D .
Returns
Section titled “Returns”A collider attachment for a supported primitive’s physics prop. See PibblPhysicsColliderAttachment2D .
See also
Section titled “See also”PibblPhysicsColliderConfiguration2D
PibblPhysicsColliderAttachment2D
View source — packages/core/src/features/physics/lib/2d/runtime/descriptors.ts:285
dynamicBody2D
Section titled “dynamicBody2D”Creates a declarative body attachment whose motion is advanced by the physics solver.
dynamicBody2D: (options?: PibblPhysicsDynamicBody2DOptions) => PibblPhysicsBodyAttachment2DRelated API: dynamicBody2D, PibblPhysicsDynamicBody2DOptions, PibblPhysicsBodyAttachment2D.
Parameters
Section titled “Parameters”options— Dynamic body, collider, and initial motion configuration. See PibblPhysicsDynamicBody2DOptions .
Returns
Section titled “Returns”A dynamic-body attachment for a supported primitive’s physics prop. See PibblPhysicsBodyAttachment2D .
See also
Section titled “See also”PibblPhysicsDynamicBody2DOptions
View source — packages/core/src/features/physics/lib/2d/runtime/descriptors.ts:162
kinematicBody2D
Section titled “kinematicBody2D”Creates a declarative body attachment driven by application-supplied target signals.
kinematicBody2D: (options?: PibblPhysicsKinematicBody2DOptions) => PibblPhysicsBodyAttachment2DRelated API: kinematicBody2D, PibblPhysicsKinematicBody2DOptions, PibblPhysicsBodyAttachment2D.
Parameters
Section titled “Parameters”options— Kinematic body, collider, and motion configuration. See PibblPhysicsKinematicBody2DOptions .
Returns
Section titled “Returns”A kinematic-body attachment for a supported primitive’s physics prop. See PibblPhysicsBodyAttachment2D .
See also
Section titled “See also”PibblPhysicsKinematicBody2DOptions
View source — packages/core/src/features/physics/lib/2d/runtime/descriptors.ts:245
staticBody2D
Section titled “staticBody2D”Creates a declarative body attachment that remains fixed in the simulation.
staticBody2D: (options?: PibblPhysicsStaticBody2DOptions) => PibblPhysicsBodyAttachment2DRelated API: staticBody2D, PibblPhysicsStaticBody2DOptions, PibblPhysicsBodyAttachment2D.
Parameters
Section titled “Parameters”options— Static body and collider configuration. See PibblPhysicsStaticBody2DOptions .
Returns
Section titled “Returns”A static-body attachment for a supported primitive’s physics prop. See PibblPhysicsBodyAttachment2D .
See also
Section titled “See also”PibblPhysicsStaticBody2DOptions
View source — packages/core/src/features/physics/lib/2d/runtime/descriptors.ts:220
withPhysicsShape2D
Section titled “withPhysicsShape2D”Adds physics-attachment support to a custom primitive using its resolved-style shape callback.
withPhysicsShape2D: <P, I, ResolvedStyle>(component: PibblPrimitiveComponent<P, I>, options: Readonly<{ resolveShape(style: Readonly<ResolvedStyle>): PibblPhysicsShape2D; }>) => PibblPrimitiveComponent<P & PibblPhysicsPrimitiveProps2D, I & { readonly physics?: PibblPhysicsAttachment2D; }>Related API: withPhysicsShape2D, ResolvedStyle, PibblPrimitiveComponent, PibblPhysicsShape2D, PibblPhysicsPrimitiveProps2D, PibblPhysicsAttachment2D.
Parameters
Section titled “Parameters”-
component— Primitive whose rendered style determines its collision shape. See PibblPrimitiveComponent . -
options— Pure resolver deriving collision geometry from resolved style. See PibblPhysicsShape2D .
Returns
Section titled “Returns”A derived primitive accepting the public physics attachment prop. See PibblPrimitiveComponent , PibblPhysicsPrimitiveProps2D , PibblPhysicsAttachment2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/custom.ts:30
pibblPhysicsBody2D
Section titled “pibblPhysicsBody2D”Returns one stable, component-owned 2D body endpoint for this hook slot.
pibblPhysicsBody2D: () => PibblPhysicsBodyHandle2DRelated API: pibblPhysicsBody2D, PibblPhysicsBodyHandle2D.
Returns
Section titled “Returns”A stable body handle that can be attached to a physics body. See PibblPhysicsBodyHandle2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:77
pibblPhysicsWorld2D
Section titled “pibblPhysicsWorld2D”Returns the nearest 2D physics world while a descendant is evaluating.
pibblPhysicsWorld2D: () => PibblPhysicsWorldHandle2DRelated API: pibblPhysicsWorld2D, PibblPhysicsWorldHandle2D.
Returns
Section titled “Returns”A stable world handle that can be attached to a physics world. See PibblPhysicsWorldHandle2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/world-component.ts:58
applyForce2D
Section titled “applyForce2D”Queues a force on a body, optionally at a world point and with wake-up control.
applyForce2D: (body: PibblPhysicsBodyHandle2D, force: PibblPhysicsVector2, options?: Readonly<{ at?: PibblPhysicsVector2; wake?: boolean; }>) => voidRelated API: applyForce2D, PibblPhysicsBodyHandle2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
body— Body receiving the force. See PibblPhysicsBodyHandle2D. -
force— Force vector in the world’s public coordinate system. See PibblPhysicsVector2 . -
options— Optional application point and wake policy. See PibblPhysicsVector2.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:98
applyImpulse2D
Section titled “applyImpulse2D”Queues an instantaneous momentum change, optionally at a world point and with wake-up control.
applyImpulse2D: (body: PibblPhysicsBodyHandle2D, impulse: PibblPhysicsVector2, options?: Readonly<{ at?: PibblPhysicsVector2; wake?: boolean; }>) => voidRelated API: applyImpulse2D, PibblPhysicsBodyHandle2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
body— Body receiving the impulse. See PibblPhysicsBodyHandle2D. -
impulse— Impulse vector in the world’s public coordinate system. See PibblPhysicsVector2 . -
options— Optional application point and wake policy. See PibblPhysicsVector2.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:130
applyTorque2D
Section titled “applyTorque2D”Queues torque on a dynamic body through the shared scheduler.
applyTorque2D: (body: PibblPhysicsBodyHandle2D, torque: number) => voidRelated API: applyTorque2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”-
body— Body receiving the torque. See PibblPhysicsBodyHandle2D. -
torque— Torque to apply in the world’s public units.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:159
disableBody2D
Section titled “disableBody2D”Queues removal of a body’s active participation in the simulation.
disableBody2D: (body: PibblPhysicsBodyHandle2D) => voidRelated API: disableBody2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”body— Body to disable. See PibblPhysicsBodyHandle2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:290
enableBody2D
Section titled “enableBody2D”Queues re-enabling a body with the requested velocity-preservation policy.
enableBody2D: (body: PibblPhysicsBodyHandle2D, options?: Readonly<{ velocity?: "zero" | "preserve"; }>) => voidRelated API: enableBody2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”-
body— Body to re-enable. See PibblPhysicsBodyHandle2D. -
options— Whether to zero or preserve velocity when enabling.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:272
setAngularVelocity2D
Section titled “setAngularVelocity2D”Queues a body’s angular velocity in degrees per second.
setAngularVelocity2D: (body: PibblPhysicsBodyHandle2D, degreesPerSecond: number) => voidRelated API: setAngularVelocity2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”-
body— Body whose angular velocity changes. See PibblPhysicsBodyHandle2D. -
degreesPerSecond— Angular speed in degrees per second.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:201
setLinearVelocity2D
Section titled “setLinearVelocity2D”Queues a body’s linear velocity in physics units per second.
setLinearVelocity2D: (body: PibblPhysicsBodyHandle2D, velocity: PibblPhysicsVector2) => voidRelated API: setLinearVelocity2D, PibblPhysicsBodyHandle2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
body— Body whose linear velocity changes. See PibblPhysicsBodyHandle2D. -
velocity— Velocity vector in public distance units per second. See PibblPhysicsVector2 .
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:180
sleepBody2D
Section titled “sleepBody2D”Queues a request to put a body to sleep.
sleepBody2D: (body: PibblPhysicsBodyHandle2D) => voidRelated API: sleepBody2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”body— Body to put to sleep. See PibblPhysicsBodyHandle2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:260
teleportBody2D
Section titled “teleportBody2D”Queues an immediate pose change for a body at the next admitted simulation command phase.
teleportBody2D: (body: PibblPhysicsBodyHandle2D, pose: PibblPhysicsPose2D) => voidRelated API: teleportBody2D, PibblPhysicsBodyHandle2D, PibblPhysicsPose2D.
Parameters
Section titled “Parameters”-
body— Body to reposition. See PibblPhysicsBodyHandle2D. -
pose— Destination position and rotation in public coordinates. See PibblPhysicsPose2D .
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:225
wakeBody2D
Section titled “wakeBody2D”Queues a request to wake a sleeping body.
wakeBody2D: (body: PibblPhysicsBodyHandle2D) => voidRelated API: wakeBody2D, PibblPhysicsBodyHandle2D.
Parameters
Section titled “Parameters”body— Body to wake. See PibblPhysicsBodyHandle2D.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/runtime/body-handle.ts:249
raycastAny2D
Section titled “raycastAny2D”Tests whether the committed world has any ray match, stopping at the first match.
raycastAny2D: (world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D) => booleanRelated API: raycastAny2D, PibblPhysicsWorldHandle2D, PibblPhysicsRay2D, PibblPhysicsQueryOptions2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
ray— Ray origin, direction, and travel limit. See PibblPhysicsRay2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Whether a matching collider exists.
View source — packages/core/src/features/physics/2d.ts:88
raycastClosest2D
Section titled “raycastClosest2D”Returns the first ray result ordered by time of impact, distance, then collider identity, or null.
raycastClosest2D: (world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D) => PibblPhysicsQueryHit2D | nullRelated API: raycastClosest2D, PibblPhysicsWorldHandle2D, PibblPhysicsRay2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryHit2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
ray— Ray origin, direction, and travel limit. See PibblPhysicsRay2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”One result or null. See PibblPhysicsQueryHit2D.
View source — packages/core/src/features/physics/2d.ts:104
raycastAll2D
Section titled “raycastAll2D”Returns all ray results ordered by time of impact, distance, then collider identity as a frozen array.
raycastAll2D: (world: PibblPhysicsWorldHandle2D, ray: PibblPhysicsRay2D, options?: PibblPhysicsQueryOptions2D) => readonly PibblPhysicsQueryHit2D[]Related API: raycastAll2D, PibblPhysicsWorldHandle2D, PibblPhysicsRay2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryHit2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
ray— Ray origin, direction, and travel limit. See PibblPhysicsRay2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Frozen results, empty when no collider matches. See PibblPhysicsQueryHit2D.
View source — packages/core/src/features/physics/2d.ts:120
shapeCastAny2D
Section titled “shapeCastAny2D”Tests whether the committed world has any shape sweep match, stopping at the first match.
shapeCastAny2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => booleanRelated API: shapeCastAny2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to sweep. See PibblPhysicsShape2D. -
from— Initial shape pose. See PibblPhysicsPose2D. -
translation— Translation vector for the sweep. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Whether a matching collider exists.
View source — packages/core/src/features/physics/2d.ts:138
shapeCastClosest2D
Section titled “shapeCastClosest2D”Returns the first shape sweep result ordered by time of impact, distance, then collider identity, or null.
shapeCastClosest2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => PibblPhysicsQueryHit2D | nullRelated API: shapeCastClosest2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D, PibblPhysicsQueryHit2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to sweep. See PibblPhysicsShape2D. -
from— Initial shape pose. See PibblPhysicsPose2D. -
translation— Translation vector for the sweep. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”One result or null. See PibblPhysicsQueryHit2D.
View source — packages/core/src/features/physics/2d.ts:158
shapeCastAll2D
Section titled “shapeCastAll2D”Returns all shape sweep results ordered by time of impact, distance, then collider identity as a frozen array.
shapeCastAll2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, from: PibblPhysicsPose2D, translation: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => readonly PibblPhysicsQueryHit2D[]Related API: shapeCastAll2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D, PibblPhysicsQueryHit2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to sweep. See PibblPhysicsShape2D. -
from— Initial shape pose. See PibblPhysicsPose2D. -
translation— Translation vector for the sweep. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Frozen results, empty when no collider matches. See PibblPhysicsQueryHit2D.
View source — packages/core/src/features/physics/2d.ts:178
hasShapeOverlap2D
Section titled “hasShapeOverlap2D”Tests whether the committed world has any shape overlap match, stopping at the first match.
hasShapeOverlap2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D) => booleanRelated API: hasShapeOverlap2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsQueryOptions2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to test. See PibblPhysicsShape2D. -
pose— Shape pose. See PibblPhysicsPose2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Whether a matching collider exists.
View source — packages/core/src/features/physics/2d.ts:197
findShapeOverlap2D
Section titled “findShapeOverlap2D”Returns the first shape overlap result ordered by collider index, then generation, or null.
findShapeOverlap2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D) => PibblPhysicsQueryMatch2D | nullRelated API: findShapeOverlap2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to test. See PibblPhysicsShape2D. -
pose— Shape pose. See PibblPhysicsPose2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”One result or null. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:215
findAllShapeOverlaps2D
Section titled “findAllShapeOverlaps2D”Returns all shape overlap results ordered by collider index, then generation as a frozen array.
findAllShapeOverlaps2D: (world: PibblPhysicsWorldHandle2D, shape: PibblPhysicsShape2D, pose: PibblPhysicsPose2D, options?: PibblPhysicsQueryOptions2D) => readonly PibblPhysicsQueryMatch2D[]Related API: findAllShapeOverlaps2D, PibblPhysicsWorldHandle2D, PibblPhysicsShape2D, PibblPhysicsPose2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
shape— Shape to test. See PibblPhysicsShape2D. -
pose— Shape pose. See PibblPhysicsPose2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Frozen results, empty when no collider matches. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:233
hasAabbMatch2D
Section titled “hasAabbMatch2D”Tests whether the committed world has any bounds intersection match, stopping at the first match.
hasAabbMatch2D: (world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D) => booleanRelated API: hasAabbMatch2D, PibblPhysicsWorldHandle2D, PibblPhysicsAabb2D, PibblPhysicsQueryOptions2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
bounds— Axis-aligned query bounds. See PibblPhysicsAabb2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Whether a matching collider exists.
View source — packages/core/src/features/physics/2d.ts:250
findAabbMatch2D
Section titled “findAabbMatch2D”Returns the first bounds intersection result ordered by collider index, then generation, or null.
findAabbMatch2D: (world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D) => PibblPhysicsQueryMatch2D | nullRelated API: findAabbMatch2D, PibblPhysicsWorldHandle2D, PibblPhysicsAabb2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
bounds— Axis-aligned query bounds. See PibblPhysicsAabb2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”One result or null. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:266
findAllAabbMatches2D
Section titled “findAllAabbMatches2D”Returns all bounds intersection results ordered by collider index, then generation as a frozen array.
findAllAabbMatches2D: (world: PibblPhysicsWorldHandle2D, bounds: PibblPhysicsAabb2D, options?: PibblPhysicsQueryOptions2D) => readonly PibblPhysicsQueryMatch2D[]Related API: findAllAabbMatches2D, PibblPhysicsWorldHandle2D, PibblPhysicsAabb2D, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
bounds— Axis-aligned query bounds. See PibblPhysicsAabb2D. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Frozen results, empty when no collider matches. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:282
hasPointMatch2D
Section titled “hasPointMatch2D”Tests whether the committed world has any point containment match, stopping at the first match.
hasPointMatch2D: (world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => booleanRelated API: hasPointMatch2D, PibblPhysicsWorldHandle2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
point— Point in simulation coordinates. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Whether a matching collider exists.
View source — packages/core/src/features/physics/2d.ts:298
findPointMatch2D
Section titled “findPointMatch2D”Returns the first point containment result ordered by collider index, then generation, or null.
findPointMatch2D: (world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => PibblPhysicsQueryMatch2D | nullRelated API: findPointMatch2D, PibblPhysicsWorldHandle2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
point— Point in simulation coordinates. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”One result or null. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:314
findAllPointMatches2D
Section titled “findAllPointMatches2D”Returns all point containment results ordered by collider index, then generation as a frozen array.
findAllPointMatches2D: (world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2, options?: PibblPhysicsQueryOptions2D) => readonly PibblPhysicsQueryMatch2D[]Related API: findAllPointMatches2D, PibblPhysicsWorldHandle2D, PibblPhysicsVector2, PibblPhysicsQueryOptions2D, PibblPhysicsQueryMatch2D.
Parameters
Section titled “Parameters”-
world— World to query. See PibblPhysicsWorldHandle2D. -
point— Point in simulation coordinates. See PibblPhysicsVector2. -
options— Sensor policy and collider filtering. See PibblPhysicsQueryOptions2D.
Returns
Section titled “Returns”Frozen results, empty when no collider matches. See PibblPhysicsQueryMatch2D.
View source — packages/core/src/features/physics/2d.ts:330
toPhysicsPoint2D
Section titled “toPhysicsPoint2D”Converts root-logical pointer coordinates to this world’s simulation space.
toPhysicsPoint2D: (world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2) => PibblPhysicsVector2Related API: toPhysicsPoint2D, PibblPhysicsWorldHandle2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
world— World providing unit and coordinate conversion. See PibblPhysicsWorldHandle2D . -
point— Point in public Canvas coordinates. See PibblPhysicsVector2.
Returns
Section titled “Returns”The equivalent point in this world’s local simulation space. See PibblPhysicsVector2 .
See also
Section titled “See also”View source — packages/core/src/features/physics/2d.ts:350
fromPhysicsPoint2D
Section titled “fromPhysicsPoint2D”Converts a simulation-space point to root-logical Canvas coordinates.
fromPhysicsPoint2D: (world: PibblPhysicsWorldHandle2D, point: PibblPhysicsVector2) => PibblPhysicsVector2Related API: fromPhysicsPoint2D, PibblPhysicsWorldHandle2D, PibblPhysicsVector2.
Parameters
Section titled “Parameters”-
world— World providing unit and coordinate conversion. See PibblPhysicsWorldHandle2D . -
point— Point in this world’s local simulation space. See PibblPhysicsVector2.
Returns
Section titled “Returns”The equivalent point in public Canvas coordinates. See PibblPhysicsVector2.
See also
Section titled “See also”View source — packages/core/src/features/physics/2d.ts:368
inspectPhysics2D
Section titled “inspectPhysics2D”Returns immutable JSON-safe observations without advancing the simulation. See PibblPhysicsWorldHandle2D. Returns the immutable observation for this currently bound body, if any. See PibblPhysicsBodyHandle2D. Returns a diagnostic snapshot of a live world or body, or undefined when unavailable.
inspectPhysics2D: { (world: PibblPhysicsWorldHandle2D): PibblPhysicsInspection2D; (body: PibblPhysicsBodyHandle2D): PibblPhysicsBodyInspection2D | undefined; }Related API: inspectPhysics2D, PibblPhysicsWorldHandle2D, PibblPhysicsInspection2D, PibblPhysicsBodyHandle2D, PibblPhysicsBodyInspection2D.
Parameters
Section titled “Parameters”-
world— World to inspect. See PibblPhysicsWorldHandle2D. -
body— Body to inspect. See PibblPhysicsBodyHandle2D. -
target— World or body handle to inspect. See PibblPhysicsWorldHandle2D , PibblPhysicsBodyHandle2D .
Returns
Section titled “Returns”Current world simulation and ownership diagnostics.
Current body diagnostics, or undefined when the handle has no live body.
The corresponding diagnostics, or undefined for an unmounted body.
See also
Section titled “See also”View source — packages/core/src/features/physics/2d.ts:388
PhysicsDebug2D
Section titled “PhysicsDebug2D”Read-only authoritative bounds, mass centers and contact normals; no hit targets.
PhysicsDebug2D: PibblPrimitiveComponent<PibblPhysicsDebug2DProps, PrimitiveInput<PibblPhysicsDebug2DProps, SystemStyle>>Related API: PhysicsDebug2D, PibblPrimitiveComponent, PibblPhysicsDebug2DProps, PrimitiveInput, SystemStyle.
Parameters
Section titled “Parameters”props— Authored component inputs, supplied through JSX or createElement. See the linked props and style types.
Throws
Section titled “Throws”When called directly; Pibbl mounts this component through JSX or createElement.
See also
Section titled “See also”View source — packages/core/src/features/physics/lib/2d/canvas/debug.ts:28
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Physics and geometry companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Physics drawing components: Draw four physics shapes and move a custom kinematic collider. Plain source
- Live physics world: Mount a falling ball, inspect it, and control its body with buttons. Plain source
- Path-like shapes: Create curved, stroked, and polygonal shapes and transform them. Plain source
- Shape measurements: Compare bounds, area, and mass for four common 2D shapes. Plain source
- Geometry queries: Check point containment, separation, overlap, contact, and casts. Plain source
- World queries: Query a static collider by ray, moving shape, overlap, point, and bounds. Plain source
Interactive examples
Section titled “Interactive examples”Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.