Table of Contents

Namespace Stride.CommunityToolkit.Box2D

Classes

BodyForces

Force, impulse, and velocity helpers applied to bodies by id.

Box2DBodyComponent

Component that ties a Stride entity to a Box2D body, with live velocity, force and impulse access once BodyId refers to a created body. The body itself is created from code through Box2DSimulation; its type, density, friction and the rest are given there.

Box2DCollisionMatrix

Which collision groups collide with which: a symmetric table over positive group numbers, where every pair collides until SetCollision(int, int, bool) says otherwise. CollisionMatrix is the one the simulation consults, for the shapes that joined a group through InCollisionGroup(B2ShapeDef, int).

Box2DDebugDraw

Box2D's own debug drawing, rendered through a ShapeBatch: every shape, joint, contact point, force, bounding box, island and body name the testbed can show, from one call a frame, with the testbed's toggles as properties.

Box2DEntityInstancing

An EntityInstancing for Box2D bodies that stops working entirely once the bodies fall asleep, mirroring BepuEntityInstancing from Stride.CommunityToolkit.Bepu.

Box2DSimulation

High-level integration facade between Box2D.NET and Stride entities. Wraps a reusable PhysicsWorld2D plus an entity/body bridge and exposes a simplified stepping, query and event API, mirroring the role BepuSimulation plays for Bepu physics in Stride.

Box2DStrideBridge

Bridge responsible for mapping Box2D bodies to Stride entities and synchronizing transforms. This isolates engine-specific concerns away from the engine-agnostic PhysicsWorld2D.

CharacterMover2D

A platformer character that is not a rigid body: a capsule the game moves itself, Quake style, with Box2D asked only what it touches. Ported from the Box2D.NET samples' Mover (MIT, (c) 2022 Erin Catto, (c) 2025 Choi Ikpil).

DistanceJointOptions

A rod or a rope: keeps two anchors a set distance apart, or within a range, optionally sprung or driven along its length.

GameExtensions

Extension methods for IGame that set up the Box2D helpers.

Grabber2DScript

Pick up any dynamic Box2D body with the mouse, drag it about, and let go - with whatever velocity it had, so a flick throws it. Put it on the camera entity and give it the simulation.

JointOptionsBase

The settings every Box2D joint shares. A property left null keeps Box2D's default for that joint type, so an empty options object is the same as passing none.

Joints2D

Box2D's seven joint types with world-space anchors: say where the pivot is and which way the axis points, and the local frames each body needs are worked out here.

MotorJointOptions

Drives body B relative to body A: a velocity to chase with capped force and torque, and a spring toward the frames' alignment. The mouse drag idiom, and the way to move a body without making it kinematic.

MoverShapeResponse

How a shape pushes a CharacterMover2D that runs into it. Stored in the shape's Box2D user data by SetResponse(B2ShapeId, float, bool); a shape without one is rigid and clips the mover's velocity, the sample's default.

PhysicsEventRouter2D

Routes Box2D contact and sensor events to registered handlers. Delegates resolution of bodies to Stride entities via a provided callback so it remains agnostic of the mapping implementation.

PhysicsQueries2D

Stateless helper methods for common Box2D query patterns. These wrappers avoid any Stride engine types and operate directly on world ids and primitive math structs only.

PhysicsStepSettings

Configuration for fixed-timestep simulation stepping used by PhysicsWorld2D.

PhysicsWorld2D

Engine-agnostic 2D physics world wrapper around Box2D.NET: owns the native world and advances it on a fixed timestep. It deliberately avoids any dependency on Stride Entity types; pairing bodies with entities is Box2DStrideBridge's job.

PrismaticJointOptions

A slider: body B moves along an axis fixed in body A, without turning relative to it.

RevoluteJointOptions

A hinge: the bodies share a pivot and turn about it. Optionally sprung toward a target angle, limited to an angular range, or driven by a motor.

ShapeFixtureBuilder

Builds Box2D shapes (fixtures) matching the toolkit's 2D primitive shapes, so a body's collision shape lines up with the rendered Primitive2D mesh of the same size.

SimulationJoints2D

Joints2D for a Box2DSimulation: the same factories with the world id filled in, and overloads that take the entities the simulation created bodies for. Reached through Joints.

SvgPath2D

Reads the straight-line commands of an SVG path into a list of points, so a level outline drawn in Inkscape can become a chain shape. Ported from the Box2D.NET samples' SvgParser (MIT, (c) 2025 Erin Catto, (c) 2025 Choi Ikpil).

WeldJointOptions

Glues two bodies together. Zero hertz is rigid; a positive value makes the weld springy on that axis, which is how breakable or soft assemblies are built.

WheelJointOptions

A wheel on a suspension: the wheel turns freely about the pivot and slides along the axis, usually sprung and limited, with a motor to drive it.

Structs

ContactEventData

A contact event delivered to IContactEventHandler implementations: the two entities and shapes involved, plus impact data for Hit events.

QueryRaycastHit

A raw 2D raycast hit returned by PhysicsQueries2D. Engine-agnostic: contains only Box2D identifiers and value types; see RaycastHit for the entity-resolved variant.

RaycastHit

A 2D raycast hit with the owning Stride entity resolved, as returned by Raycast(Vector2, Vector2, float) and RaycastAll(Vector2, Vector2, float). See QueryRaycastHit for the raw engine-agnostic variant.

SensorEventData

A sensor overlap event delivered to ISensorEventHandler implementations.

ShapeCastHit

The closest hit of a shape cast from PhysicsQueries2D: the shape and body struck, where, the surface normal there, and how far along the sweep it happened.

Interfaces

IBox2DSimulationUpdate

Implemented by objects that want to run logic before and after each simulation update, mirroring the ISimulationUpdate pattern of Stride's Bepu physics integration.

IContactEventHandler

Implemented by objects that want to receive contact and hit events from the simulation. Register with RegisterContactEventHandler(IContactEventHandler).

ISensorEventHandler

Implemented by objects that want to receive sensor overlap events from the simulation. Register with RegisterSensorEventHandler(ISensorEventHandler).

Enums

ContactEventType

The kind of contact event carried by a ContactEventData.

PogoShape

The shape a CharacterMover2D casts downward to find the ground under its feet.

SensorEventType

The kind of sensor event carried by a SensorEventData.