package vendor:box2d

⌘K
Ctrl+K
or
/

    Overview

    Generated by vendor-build/box2d/gen from Box2D's api/box2d_api.json, do not edit by hand.

    Generated by vendor-build/box2d/gen from Box2D's api/box2d_api.json, do not edit by hand.

    Generated by vendor-build/box2d/gen from Box2D's api/box2d_api.json, do not edit by hand.

    Generated by vendor-build/box2d/gen from Box2D's api/box2d_api.json, do not edit by hand.

    Bindings for Box2D.

    Generated by vendor-build/box2d/gen from Box2D's api/box2d_api.json, do not edit by hand.

    External Examples 1 ¶

    The programs in odin-lang/examples about this package, and how many of its declarations each uses.

    Index

    Types (113)
    Variables (0)

    This section is empty.

    Procedures (605)
    Procedure Groups (0)

    This section is empty.

    Types

    AllocCallbackFcn ¶

    AllocCallbackFcn :: proc "c" (size: uint, alignment: i32) -> rawptr
     

    Prototype for user allocation function @param size the allocation size in bytes @param alignment the required alignment, guaranteed to be a power of 2

    AssertCallbackFcn ¶

    AssertCallbackFcn :: proc "c" (condition: cstring, fileName: cstring, lineNumber: i32) -> i32
     

    Prototype for the user assert callback. Return 0 to skip the debugger break.

    BodyDef ¶

    BodyDef :: struct {
    	// The body type: static, kinematic, or dynamic.
    	type:                   BodyType,
    	// The initial world position of the body. Bodies should be created with the desired position.
    	// @note Creating bodies at the origin and then moving them nearly doubles the cost of body
    	// creation, especially if the body is moved after shapes have been added.
    	position:               [2]f32,
    	// The initial world rotation of the body. Use b2MakeRot() if you have an angle.
    	rotation:               Rot,
    	// The initial linear velocity of the body's origin. Usually in meters per second.
    	linearVelocity:         [2]f32,
    	// The initial angular velocity of the body. Radians per second.
    	angularVelocity:        f32,
    	// Linear damping is used to reduce the linear velocity. The damping parameter can be larger
    	// than 1 but the damping effect becomes sensitive to the time step when the damping parameter
    	// is large. Generally linear damping is undesirable because it makes objects move slowly as if
    	// they are floating.
    	linearDamping:          f32,
    	// Angular damping is used to reduce the angular velocity. The damping parameter can be larger
    	// than 1.0f but the damping effect becomes sensitive to the time step when the damping
    	// parameter is large. Angular damping can be used to slow down rotating bodies.
    	angularDamping:         f32,
    	// Scale the gravity applied to this body. Non-dimensional.
    	gravityScale:           f32,
    	// Sleep speed threshold, default is 0.05 meters per second
    	sleepThreshold:         f32,
    	// Continuous collision safety factor. The solver only uses continuous collision if there is a
    	// risk of tunneling. If the body is moving fast enough to risk tunneling then it is considered
    	// a "fast body". This improves performance and prevents movement hitches. If a body moving N
    	// meters risks tunneling, then the body will be considered fast if it moves more than a
    	// safetyFactor times N meters over one full time step. Non-dimensional. Recommended range
    	// [0.01, 0.5]. Default is 0.5 for high performance with low tunneling risk.
    	safetyFactor:           f32,
    	// Optional body name for debugging. Up to B2_NAME_LENGTH characters
    	name:                   cstring,
    	// Use this to store application specific body data.
    	userData:               rawptr,
    	// Motion locks to restrict linear and angular movement. Caution: may lead to softer
    	// constraints along the locked direction
    	motionLocks:            MotionLocks,
    	// Set this flag to false if this body should never fall asleep.
    	enableSleep:            bool,
    	// Is this body initially awake or sleeping?
    	isAwake:                bool,
    	// Treat this dynamic body as a high speed object that performs continuous collision detection
    	// against dynamic and kinematic bodies, but not other bullet bodies.
    	// @warning Bullets should be used sparingly. They are not a solution for general
    	// dynamic-versus-dynamic continuous collision. They do not guarantee accurate collision if
    	// both bodies are fast moving because the bullet does a continuous check after all non-bullet
    	// bodies have moved. You could get unlucky and have the bullet body end a time step very close
    	// to a non-bullet body and the non-bullet body then moves over the bullet body. In continuous
    	// collision, initial overlap is ignored to avoid freezing bodies in place. I do not recommend
    	// using them for game projectiles if precise collision timing is needed. Instead consider
    	// using a ray or shape cast. You can use a marching ray or shape cast for a projectile that
    	// moves over time. If you want a fast moving projectile to collide with a fast moving target,
    	// you need to consider the relative movement in your ray or shape cast. This is out of the
    	// scope of Box2D. So what are good use cases for bullets? Pinball games or games with dynamic
    	// containers that hold other objects. It should be a use case where it doesn't break the game
    	// if there is a collision missed, but having them captured improves the quality of the game.
    	isBullet:               bool,
    	// Used to disable a body. A disabled body does not move or collide.
    	isEnabled:              bool,
    	// This allows this body to bypass rotational speed limits. Should only be used for circular
    	// objects, like wheels.
    	allowFastRotation:      bool,
    	// Enable contact recycling. True by default. Leaving this enabled improves performance but may
    	// lead to ghost collisions that should be avoided on characters.
    	enableContactRecycling: bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:          i32,
    }
     

    A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction. Body definitions are temporary objects used to bundle creation parameters. Must be initialized using b2DefaultBodyDef().

    BodyEvents ¶

    BodyEvents :: struct {
    	// Array of move events
    	moveEvents: [^]BodyMoveEvent `fmt:"v,moveCount"`,
    	// Number of move events
    	moveCount:  i32,
    }
     

    Body events are buffered in the Box2D world and are available as event arrays after the time step is complete. Note: this data becomes invalid if bodies are destroyed

    BodyId ¶

    BodyId :: struct {
    	index1:     i32,
    	world0:     u16,
    	generation: u16,
    }
     

    Body id references a body instance. This should be treated as an opaque handle.

    External examples raylib/box2d

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    BodyMoveEvent ¶

    BodyMoveEvent :: struct {
    	// The body user data.
    	userData:   rawptr,
    	// The world transform of the body.
    	transform:  Transform,
    	// The id of the body that moved.
    	bodyId:     BodyId,
    	// Did the body fall asleep this time step?
    	fellAsleep: bool,
    }
     

    Body move events triggered when a body moves. Triggered when a body moves due to simulation. Not reported for bodies moved by the user. This also has a flag to indicate that the body went to sleep so the application can also sleep that actor/entity/object associated with the body. On the other hand if the flag does not indicate the body went to sleep then the application can treat the actor/entity/object associated with the body as awake. This is an efficient way for an application to update game object transforms rather than calling functions such as b2Body_GetTransform() because this data is delivered as a contiguous array and it is only populated with bodies that have moved. @note If sleeping is disabled all dynamic and kinematic bodies will trigger move events.

    BodyType ¶

    BodyType :: enum i32 {
    	// zero mass, zero velocity, may be manually moved
    	staticBody    = 0, 
    	// zero mass, velocity set by user, moved by solver
    	kinematicBody = 1, 
    	// positive mass, velocity determined by forces, moved by solver
    	dynamicBody   = 2, 
    	// number of body types
    	bodyTypeCount, 
    }
     

    The body simulation type. Each body is one of these three types. The type determines how the body behaves in the simulation.

    BoxCastInput ¶

    BoxCastInput :: struct {
    	// The AABB to cast, in the tree's frame.
    	box:         AABB,
    	// The sweep translation.
    	translation: [2]f32,
    	// The maximum fraction of the translation to consider, typically 1.
    	maxFraction: f32,
    }
     

    Input for casting an AABB through a dynamic tree

    Capacity ¶

    Capacity :: struct {
    	// Number of expected static shapes.
    	staticShapeCount:  i32,
    	// Number of expected dynamic and kinematic shapes.
    	dynamicShapeCount: i32,
    	// Number of expected static bodies.
    	staticBodyCount:   i32,
    	// Number of expected dynamic and kinematic bodies.
    	dynamicBodyCount:  i32,
    	// Number of expected contacts.
    	contactCount:      i32,
    	// Reserve arena allocator space, used for temporary allocations.
    	arenaByteCount:    i32,
    }
     

    Optional world capacities that can be used to avoid run-time allocations. @see b2World_GetMaxCapacity

    Capsule ¶

    Capsule :: struct {
    	// Local center of the first semicircle
    	center1: [2]f32,
    	// Local center of the second semicircle
    	center2: [2]f32,
    	// The radius of the semicircles
    	radius:  f32,
    }
     

    A solid capsule can be viewed as two semicircles connected by a rectangle.

    Related Procedures With Parameters

    CastOutput ¶

    CastOutput :: struct {
    	// The surface normal at the hit point
    	normal:     [2]f32,
    	// The surface hit point
    	point:      [2]f32,
    	// The fraction of the input translation at collision
    	fraction:   f32,
    	// The number of iterations used
    	iterations: i32,
    	// Did the cast hit?
    	hit:        bool,
    }
     

    Low level ray cast or shape cast output data. The hit point is in the local or relative frame of the input. Returns a zero fraction and normal in the case of initial overlap.

    Related Procedures With Returns

    CastResultCallbackFcn ¶

    CastResultCallbackFcn :: proc "c" (shapeId: ShapeId, point: [2]f32, normal: [2]f32, fraction: f32, userContext: rawptr) -> f32
     

    Prototype callback for ray and shape casts. Called for each shape found in the query. You control how the ray cast proceeds by returning a float:

    • return -1: ignore this shape and continue
    • return 0: terminate the ray cast
    • return fraction: clip the ray to this point
    • return 1: don't clip the ray and continue A cast with initial overlap will return a zero fraction and a zero normal. @param shapeId the shape hit by the ray @param point the point of initial intersection @param normal the normal vector at the point of intersection, zero for a shape cast with initial overlap @param fraction the fraction along the ray at the point of intersection, zero for a shape cast with initial overlap @param context the user context @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue @see b2World_CastRay

    Related Procedures With Parameters

    ChainDef ¶

    ChainDef :: struct {
    	// Use this to store application specific shape data.
    	userData:           rawptr,
    	// Array of chain points. Each consecutive pair forms a segment. For a loop the last and first
    	// point form a segment. Cloned.
    	points:             [^][2]f32 `fmt:"v,pointCount"`,
    	// The point count. At least 2 for an open chain and at least 3 for a loop.
    	// segmentCount = isLoop ? pointCount : pointCount - 1
    	pointCount:         i32,
    	// Leading ghost point for an open chain. Distance from first point must be greater than
    	// B2_LINEAR_SLOP. Ignored for loops.
    	ghost1:             [2]f32,
    	// Ending ghost point for an open chain. Distance from last point must be greater than
    	// B2_LINEAR_SLOP. Ignored for loops.
    	ghost2:             [2]f32,
    	// One material for the whole chain or one for each segment. Cloned.
    	materials:          [^]SurfaceMaterial `fmt:"v,materialCount"`,
    	// The material count. Must be 1 or the segment count.
    	materialCount:      i32,
    	// Contact filtering data.
    	filter:             Filter,
    	// Indicates a closed chain formed by connecting the first and last point.
    	isLoop:             bool,
    	// Enable sensors to detect this chain. False by default.
    	enableSensorEvents: bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:      i32,
    }
     

    Used to create a chain of line segments. This is designed to eliminate ghost collisions with some limitations.

    • chains are one-sided
    • chains have no mass and should be used on static bodies
    • chains have a counter-clockwise winding order (normal points right of segment direction)
    • chains are either a loop or open
    • the distance between any two points must be greater than B2_LINEAR_SLOP
    • a chain shape should not self intersect (this is not validated)
    • an open chain shape needs a leading and trailing ghost point.
    • you may overlap two open chains using the ghost points to get smooth collision.
    • a chain shape creates multiple line segment shapes on the body https://en.wikipedia.org/wiki/Polygonal_chain Must be initialized using b2DefaultChainDef(). @warning Do not use chain shapes unless you understand the limitations. This is an advanced feature.

    ChainId ¶

    ChainId :: struct {
    	index1:     i32,
    	world0:     u16,
    	generation: u16,
    }
     

    Chain id references a chain instance. This should be treated as an opaque handle.

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    ChainSegment ¶

    ChainSegment :: struct {
    	// The tail ghost vertex
    	ghost1:  [2]f32,
    	// The line segment
    	segment: Segment,
    	// The head ghost vertex
    	ghost2:  [2]f32,
    	// The owning chain shape index (internal usage only)
    	chainId: i32,
    }
     

    A line segment with one-sided collision. Only collides on the right side. Several of these are generated for a chain shape. ghost1 -> point1 -> point2 -> ghost2

    Related Procedures With Parameters

    CollisionPlane ¶

    CollisionPlane :: struct {
    	// The collision plane between the mover and some shape.
    	plane:        Plane,
    	// Setting this to FLT_MAX makes the plane as rigid as possible. Lower values can make the
    	// plane collision soft. Usually in meters.
    	pushLimit:    f32,
    	// The push on the mover determined by b2SolvePlanes. Usually in meters.
    	push:         f32,
    	// Indicates if b2ClipVector should clip against this plane. Should be false for soft
    	// collision.
    	clipVelocity: bool,
    }
     

    These are collision planes that can be fed to b2SolvePlanes. Normally this is assembled by the user from plane results in b2PlaneResult.

    ContactBeginTouchEvent ¶

    ContactBeginTouchEvent :: struct {
    	// Id of the first shape
    	shapeIdA:  ShapeId,
    	// Id of the second shape
    	shapeIdB:  ShapeId,
    	// The transient contact id. This contact may be destroyed automatically when the world is
    	// modified or simulated. Use b2Contact_IsValid before using this id.
    	contactId: ContactId,
    }
     

    A begin touch event is generated when two shapes begin touching.

    ContactData ¶

    ContactData :: struct {
    	// The contact id. You may hold onto this to track a contact across time steps. This id may
    	// become orphaned. Use b2Contact_IsValid before using it for other functions.
    	contactId: ContactId,
    	// The first shape id.
    	shapeIdA:  ShapeId,
    	// The second shape id.
    	shapeIdB:  ShapeId,
    	// The manifold copied from the contact.
    	manifold:  Manifold,
    }
     

    The contact data for two shapes. By convention the manifold normal points from shape A to shape B. @see b2Shape_GetContactData() and b2Body_GetContactData()

    ContactEndTouchEvent ¶

    ContactEndTouchEvent :: struct {
    	// Id of the first shape
    	shapeIdA:  ShapeId,
    	// Id of the second shape
    	shapeIdB:  ShapeId,
    	// The transient contact id. This contact may be destroyed automatically when the world is
    	// modified or simulated. Use b2Contact_IsValid before using this id.
    	contactId: ContactId,
    }
     

    An end touch event is generated when two shapes stop touching. You will get an end event if you do anything that destroys contacts previous to the last world step. These include things like setting the transform, destroying a body or shape, or changing a filter or body type.

    ContactEvents ¶

    ContactEvents :: struct {
    	// Array of begin touch events
    	beginEvents: [^]ContactBeginTouchEvent `fmt:"v,beginCount"`,
    	// Array of end touch events
    	endEvents:   [^]ContactEndTouchEvent `fmt:"v,endCount"`,
    	// Array of hit events
    	hitEvents:   [^]ContactHitEvent `fmt:"v,hitCount"`,
    	// Number of begin touch events
    	beginCount:  i32,
    	// Number of end touch events
    	endCount:    i32,
    	// Number of hit events
    	hitCount:    i32,
    }
     

    Contact events are buffered in the Box2D world and are available as event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed

    ContactHitEvent ¶

    ContactHitEvent :: struct {
    	// Id of the first shape
    	shapeIdA:      ShapeId,
    	// Id of the second shape
    	shapeIdB:      ShapeId,
    	// Id of the contact.
    	// @warning this contact may have been destroyed
    	// @see b2Contact_IsValid
    	contactId:     ContactId,
    	// Point where the shapes hit. This is a mid-point between the two surfaces. It could be a
    	// speculative point where the shapes were not touching at the beginning of the time step. The
    	// point is reconstructed after the step, so when both bodies are moving it may trail the
    	// impact by up to one step of motion.
    	point:         [2]f32,
    	// Normal vector pointing from shape A to shape B
    	normal:        [2]f32,
    	// The speed the shapes are approaching. Always positive. Typically in meters per second.
    	approachSpeed: f32,
    }
     

    A hit event is generated when two shapes collide with a speed faster than the hit event threshold. This may be reported for speculative contacts that have a confirmed impulse.

    ContactId ¶

    ContactId :: struct {
    	index1:     i32,
    	world0:     u16,
    	padding:    i16,
    	generation: u32,
    }
     

    Contact id references a contact instance. This should be treated as an opaque handle.

    Related Procedures With Parameters

    Related Constants

    CosSin ¶

    CosSin :: struct {
    	// cosine and sine
    	cosine: f32,
    	sine:   f32,
    }
     

    Cosine and sine pair This uses a custom implementation designed for cross-platform determinism

    Counters ¶

    Counters :: struct {
    	byteCount:            uint,
    	bodyCount:            i32,
    	shapeCount:           i32,
    	contactCount:         i32,
    	jointCount:           i32,
    	islandCount:          i32,
    	stackUsed:            i32,
    	staticTreeHeight:     i32,
    	treeHeight:           i32,
    	taskCount:            i32,
    	colorCounts:          [24]i32,
    	// Number of contacts touched by the collide pass (graph contacts + awake-set non-touching).
    	awakeContactCount:    i32,
    	// Number of contacts recycled in the most recent step.
    	recycledContactCount: i32,
    }
     

    Counters that give details of the simulation size.

    CustomFilterCallbackFcn ¶

    CustomFilterCallbackFcn :: proc "c" (shapeIdA: ShapeId, shapeIdB: ShapeId, userContext: rawptr) -> bool
     

    Prototype for a contact filter callback. This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled. Notes:

    • this function must be thread-safe
    • this is only called if one of the two shapes has enabled custom filtering
    • this may be called for awake dynamic bodies and sensors Return false if you want to disable the collision @see b2ShapeDef @warning Do not attempt to modify the world inside this callback

    DebugDraw ¶

    DebugDraw :: struct {
    	// Draw a closed polygon provided in CCW order.
    	DrawPolygonFcn:      proc "c" (transform: Transform, vertices: [^][2]f32, vertexCount: i32, color: HexColor, userContext: rawptr),
    	// Draw a solid closed polygon provided in CCW order.
    	DrawSolidPolygonFcn: proc "c" (transform: Transform, vertices: [^][2]f32, vertexCount: i32, radius: f32, color: HexColor, userContext: rawptr),
    	// Draw a circle.
    	DrawCircleFcn:       proc "c" (center: [2]f32, radius: f32, color: HexColor, userContext: rawptr),
    	// Draw a solid circle.
    	DrawSolidCircleFcn:  proc "c" (transform: Transform, center: [2]f32, radius: f32, color: HexColor, userContext: rawptr),
    	// Draw a solid capsule.
    	DrawSolidCapsuleFcn: proc "c" (p1: [2]f32, p2: [2]f32, radius: f32, color: HexColor, userContext: rawptr),
    	// Draw a line segment.
    	DrawLineFcn:         proc "c" (p1: [2]f32, p2: [2]f32, color: HexColor, userContext: rawptr),
    	// Draw a transform. Choose your own length scale.
    	DrawTransformFcn:    proc "c" (transform: Transform, userContext: rawptr),
    	// Draw a point.
    	DrawPointFcn:        proc "c" (p: [2]f32, size: f32, color: HexColor, userContext: rawptr),
    	// Draw a string in world space.
    	DrawStringFcn:       proc "c" (p: [2]f32, s: cstring, color: HexColor, userContext: rawptr),
    	// Draw a bounding box.
    	DrawBoundsFcn:       proc "c" (aabb: AABB, color: HexColor, userContext: rawptr),
    	// World bounds used for debug draw. An empty box draws nothing.
    	drawingBounds:       AABB,
    	// Scale to use when drawing forces
    	forceScale:          f32,
    	// Global scaling for joint drawing
    	jointScale:          f32,
    	// Option to draw contact points
    	drawContacts:        bool,
    	// Draw anchor A for contact points (instead of anchorB)
    	drawAnchorA:         bool,
    	// Option to draw shapes
    	drawShapes:          bool,
    	// Option to draw chain shape normals
    	drawChainNormals:    bool,
    	// Option to draw joints
    	drawJoints:          bool,
    	// Option to draw additional information for joints
    	drawJointExtras:     bool,
    	// Option to draw the bounding boxes for shapes
    	drawBounds:          bool,
    	// Option to draw the mass and center of mass of dynamic bodies
    	drawMass:            bool,
    	// Option to draw body names
    	drawBodyNames:       bool,
    	// Option to visualize the graph coloring used for contacts and joints
    	drawGraphColors:     bool,
    	// Option to draw contact feature ids
    	drawContactFeatures: bool,
    	// Option to draw contact normals
    	drawContactNormals:  bool,
    	// Option to draw contact normal forces
    	drawContactForces:   bool,
    	// Option to draw contact friction forces
    	drawFrictionForces:  bool,
    	// Option to draw islands as bounding boxes
    	drawIslands:         bool,
    	// User context that is passed as an argument to drawing callback functions
    	userContext:         rawptr,
    }
     

    This struct holds callbacks you can implement to draw a Box2D world. Callbacks receive world coordinates. In large world mode the translation is double precision so it stays accurate far from the origin. Shift into your own camera frame inside the callbacks. Initialize with b2DefaultDebugDraw.

    Related Procedures With Parameters

    DistanceInput ¶

    DistanceInput :: struct {
    	// The proxy for shape A
    	proxyA:    ShapeProxy,
    	// The proxy for shape B
    	proxyB:    ShapeProxy,
    	// Transform of shape B in shape A's frame, the relative pose B in A (b2InvMulTransforms(
    	// worldA, worldB )). The query is origin independent and runs in frame A.
    	transform: Transform,
    	// Should the proxy radius be considered?
    	useRadii:  bool,
    }
     

    Input for b2ComputeShapeDistance

    DistanceJointDef ¶

    DistanceJointDef :: struct {
    	// Base joint definition
    	using base:       JointDef,
    	// The rest length of this joint. Clamped to a stable minimum value.
    	length:           f32,
    	// Enable the distance constraint to behave like a spring. If false then the distance joint
    	// will be rigid, overriding the limit and motor.
    	enableSpring:     bool,
    	// The lower spring force controls how much tension it can sustain.
    	lowerSpringForce: f32,
    	// The upper spring force controls how much compression it can sustain.
    	upperSpringForce: f32,
    	// The spring linear stiffness Hertz, cycles per second.
    	hertz:            f32,
    	// The spring linear damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Enable/disable the joint limit
    	enableLimit:      bool,
    	// Minimum length for limit. Clamped to a stable minimum value.
    	minLength:        f32,
    	// Maximum length for limit. Must be greater than or equal to the minimum length.
    	maxLength:        f32,
    	// Enable/disable the joint motor
    	enableMotor:      bool,
    	// The maximum motor force, usually in newtons
    	maxMotorForce:    f32,
    	// The desired motor speed, usually in meters per second
    	motorSpeed:       f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Distance joint definition Connects a point on body A with a point on body B by a segment. Useful for ropes and springs.

    Fields Through using (11)

    From using base: JointDef

    DistanceOutput ¶

    DistanceOutput :: struct {
    	// Closest point on shapeA, in shape A's frame
    	pointA:       [2]f32,
    	// Closest point on shapeB, in shape A's frame
    	pointB:       [2]f32,
    	// A to B normal in shape A's frame. Invalid if distance is zero.
    	normal:       [2]f32,
    	// The final distance, zero if overlapped
    	distance:     f32,
    	// Number of GJK iterations used
    	iterations:   i32,
    	// The number of simplexes stored in the simplex array
    	simplexCount: i32,
    }
     

    Output for b2ComputeShapeDistance

    EnqueueTaskCallbackFcn ¶

    EnqueueTaskCallbackFcn :: proc "c" (task: TaskCallbackFcn, taskContext: rawptr, userContext: rawptr) -> rawptr
     

    These functions can be provided to Box2D to invoke a task system. Returns a pointer to the user's task object. May be nullptr. A nullptr indicates to Box2D that the work was executed serially within the callback and there is no need to call b2FinishTaskCallbackFcn.

    ExplosionDef ¶

    ExplosionDef :: struct {
    	// Mask bits to filter shapes
    	maskBits:         u64,
    	// The center of the explosion in world space
    	position:         [2]f32,
    	// The radius of the explosion
    	radius:           f32,
    	// The falloff distance beyond the radius. Impulse is reduced to zero at this distance.
    	falloff:          f32,
    	// Impulse per unit length. This applies an impulse according to the shape perimeter that is
    	// facing the explosion. Explosions only apply to circles, capsules, and polygons. This may be
    	// negative for implosions.
    	impulsePerLength: f32,
    }
     

    The explosion definition is used to configure options for explosions. Explosions consider shape geometry when computing the impulse.

    Filter ¶

    Filter :: struct {
    	// The collision category bits. Normally you would just set one bit. The category bits should
    	// represent your application object types. For example:
    	// @code{.cpp}
    	// enum MyCategories
    	// {
    	//    Static  = 0x00000001,
    	//    Dynamic = 0x00000002,
    	//    Debris  = 0x00000004,
    	//    Player  = 0x00000008,
    	//    // etc
    	// };
    	// @endcode
    	categoryBits: u64,
    	// The collision mask bits. This states the categories that this shape would accept for
    	// collision. For example, you may want your player to only collide with static objects and
    	// other players.
    	// @code{.c}
    	// maskBits = Static | Player;
    	// @endcode
    	maskBits:     u64,
    	// Collision groups allow a certain group of objects to never collide (negative) or always
    	// collide (positive). A group index of zero has no effect. Non-zero group filtering always
    	// wins against the mask bits. For example, you may want ragdolls to collide with other
    	// ragdolls but you don't want ragdoll self-collision. In this case you would give each ragdoll
    	// a unique negative group index and apply that group index to all shapes on the ragdoll.
    	groupIndex:   i32,
    }
     

    This is used to filter collision on shapes. It affects shape-vs-shape collision and shape-versus-query collision (such as b2World_CastRay).

    Related Procedures With Returns

    FilterJointDef ¶

    FilterJointDef :: struct {
    	// Base joint definition
    	using base:    JointDef,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue: i32,
    }
     

    A filter joint is used to disable collision between two specific bodies.

    Fields Through using (11)

    From using base: JointDef

    FinishTaskCallbackFcn ¶

    FinishTaskCallbackFcn :: proc "c" (userTask: rawptr, userContext: rawptr)
     

    Finishes a user task object that wraps a Box2D task.

    FreeCallbackFcn ¶

    FreeCallbackFcn :: proc "c" (mem: rawptr, size: uint)
     

    Prototype for user free function @param mem the memory previously allocated through b2AllocCallbackFcn @param size the allocation size in bytes

    FrictionCallbackFcn ¶

    FrictionCallbackFcn :: proc "c" (frictionA: f32, userMaterialIdA: u64, frictionB: f32, userMaterialIdB: u64) -> f32
     

    Optional friction mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box2D state or user application state.

    HexColor ¶

    HexColor :: enum i32 {
    	AliceBlue            = 0xF0F8FF, 
    	AntiqueWhite         = 0xFAEBD7, 
    	Aqua                 = 0x00FFFF, 
    	Aquamarine           = 0x7FFFD4, 
    	Azure                = 0xF0FFFF, 
    	Beige                = 0xF5F5DC, 
    	Bisque               = 0xFFE4C4, 
    	Black                = 0x000000, 
    	BlanchedAlmond       = 0xFFEBCD, 
    	Blue                 = 0x0000FF, 
    	BlueViolet           = 0x8A2BE2, 
    	Brown                = 0xA52A2A, 
    	Burlywood            = 0xDEB887, 
    	CadetBlue            = 0x5F9EA0, 
    	Chartreuse           = 0x7FFF00, 
    	Chocolate            = 0xD2691E, 
    	Coral                = 0xFF7F50, 
    	CornflowerBlue       = 0x6495ED, 
    	Cornsilk             = 0xFFF8DC, 
    	Crimson              = 0xDC143C, 
    	Cyan                 = 0x00FFFF, 
    	DarkBlue             = 0x00008B, 
    	DarkCyan             = 0x008B8B, 
    	DarkGoldenRod        = 0xB8860B, 
    	DarkGray             = 0xA9A9A9, 
    	DarkGreen            = 0x006400, 
    	DarkKhaki            = 0xBDB76B, 
    	DarkMagenta          = 0x8B008B, 
    	DarkOliveGreen       = 0x556B2F, 
    	DarkOrange           = 0xFF8C00, 
    	DarkOrchid           = 0x9932CC, 
    	DarkRed              = 0x8B0000, 
    	DarkSalmon           = 0xE9967A, 
    	DarkSeaGreen         = 0x8FBC8F, 
    	DarkSlateBlue        = 0x483D8B, 
    	DarkSlateGray        = 0x2F4F4F, 
    	DarkTurquoise        = 0x00CED1, 
    	DarkViolet           = 0x9400D3, 
    	DeepPink             = 0xFF1493, 
    	DeepSkyBlue          = 0x00BFFF, 
    	DimGray              = 0x696969, 
    	DodgerBlue           = 0x1E90FF, 
    	FireBrick            = 0xB22222, 
    	FloralWhite          = 0xFFFAF0, 
    	ForestGreen          = 0x228B22, 
    	Fuchsia              = 0xFF00FF, 
    	Gainsboro            = 0xDCDCDC, 
    	GhostWhite           = 0xF8F8FF, 
    	Gold                 = 0xFFD700, 
    	GoldenRod            = 0xDAA520, 
    	Gray                 = 0x808080, 
    	Green                = 0x008000, 
    	GreenYellow          = 0xADFF2F, 
    	HoneyDew             = 0xF0FFF0, 
    	HotPink              = 0xFF69B4, 
    	IndianRed            = 0xCD5C5C, 
    	Indigo               = 0x4B0082, 
    	Ivory                = 0xFFFFF0, 
    	Khaki                = 0xF0E68C, 
    	Lavender             = 0xE6E6FA, 
    	LavenderBlush        = 0xFFF0F5, 
    	LawnGreen            = 0x7CFC00, 
    	LemonChiffon         = 0xFFFACD, 
    	LightBlue            = 0xADD8E6, 
    	LightCoral           = 0xF08080, 
    	LightCyan            = 0xE0FFFF, 
    	LightGoldenRodYellow = 0xFAFAD2, 
    	LightGray            = 0xD3D3D3, 
    	LightGreen           = 0x90EE90, 
    	LightPink            = 0xFFB6C1, 
    	LightSalmon          = 0xFFA07A, 
    	LightSeaGreen        = 0x20B2AA, 
    	LightSkyBlue         = 0x87CEFA, 
    	LightSlateGray       = 0x778899, 
    	LightSteelBlue       = 0xB0C4DE, 
    	LightYellow          = 0xFFFFE0, 
    	Lime                 = 0x00FF00, 
    	LimeGreen            = 0x32CD32, 
    	Linen                = 0xFAF0E6, 
    	Magenta              = 0xFF00FF, 
    	Maroon               = 0x800000, 
    	MediumAquaMarine     = 0x66CDAA, 
    	MediumBlue           = 0x0000CD, 
    	MediumOrchid         = 0xBA55D3, 
    	MediumPurple         = 0x9370DB, 
    	MediumSeaGreen       = 0x3CB371, 
    	MediumSlateBlue      = 0x7B68EE, 
    	MediumSpringGreen    = 0x00FA9A, 
    	MediumTurquoise      = 0x48D1CC, 
    	MediumVioletRed      = 0xC71585, 
    	MidnightBlue         = 0x191970, 
    	MintCream            = 0xF5FFFA, 
    	MistyRose            = 0xFFE4E1, 
    	Moccasin             = 0xFFE4B5, 
    	NavajoWhite          = 0xFFDEAD, 
    	Navy                 = 0x000080, 
    	OldLace              = 0xFDF5E6, 
    	Olive                = 0x808000, 
    	OliveDrab            = 0x6B8E23, 
    	Orange               = 0xFFA500, 
    	OrangeRed            = 0xFF4500, 
    	Orchid               = 0xDA70D6, 
    	PaleGoldenRod        = 0xEEE8AA, 
    	PaleGreen            = 0x98FB98, 
    	PaleTurquoise        = 0xAFEEEE, 
    	PaleVioletRed        = 0xDB7093, 
    	PapayaWhip           = 0xFFEFD5, 
    	PeachPuff            = 0xFFDAB9, 
    	Peru                 = 0xCD853F, 
    	Pink                 = 0xFFC0CB, 
    	Plum                 = 0xDDA0DD, 
    	PowderBlue           = 0xB0E0E6, 
    	Purple               = 0x800080, 
    	RebeccaPurple        = 0x663399, 
    	Red                  = 0xFF0000, 
    	RosyBrown            = 0xBC8F8F, 
    	RoyalBlue            = 0x4169E1, 
    	SaddleBrown          = 0x8B4513, 
    	Salmon               = 0xFA8072, 
    	SandyBrown           = 0xF4A460, 
    	SeaGreen             = 0x2E8B57, 
    	SeaShell             = 0xFFF5EE, 
    	Sienna               = 0xA0522D, 
    	Silver               = 0xC0C0C0, 
    	SkyBlue              = 0x87CEEB, 
    	SlateBlue            = 0x6A5ACD, 
    	SlateGray            = 0x708090, 
    	Snow                 = 0xFFFAFA, 
    	SpringGreen          = 0x00FF7F, 
    	SteelBlue            = 0x4682B4, 
    	Tan                  = 0xD2B48C, 
    	Teal                 = 0x008080, 
    	Thistle              = 0xD8BFD8, 
    	Tomato               = 0xFF6347, 
    	Turquoise            = 0x40E0D0, 
    	Violet               = 0xEE82EE, 
    	Wheat                = 0xF5DEB3, 
    	White                = 0xFFFFFF, 
    	WhiteSmoke           = 0xF5F5F5, 
    	Yellow               = 0xFFFF00, 
    	YellowGreen          = 0x9ACD32, 
    	Box2DRed             = 0xDC3132, 
    	Box2DBlue            = 0x30AEBF, 
    	Box2DGreen           = 0x8CC924, 
    	Box2DYellow          = 0xFFEE8C, 
    }
     

    These colors are used for debug draw and mostly match the named SVG colors. See https://www.rapidtables.com/web/color/index.html https://johndecember.com/html/spec/colorsvg.html https://upload.wikimedia.org/wikipedia/commons/2/2b/SVG_Recognized_color_keyword_names.svg

    Hull ¶

    Hull :: struct {
    	// The final points of the hull
    	points: [8][2]f32 `fmt:"v,count"`,
    	// The number of points
    	count:  i32,
    }
     

    A convex hull. Used to create convex polygons. @warning Do not modify these values directly, instead use b2ComputeHull()

    Related Procedures With Parameters

    JointDef ¶

    JointDef :: struct {
    	// User data pointer
    	userData:               rawptr,
    	// The first attached body
    	bodyIdA:                BodyId,
    	// The second attached body
    	bodyIdB:                BodyId,
    	// The first local joint frame
    	localFrameA:            Transform,
    	// The second local joint frame
    	localFrameB:            Transform,
    	// Force threshold for joint events
    	forceThreshold:         f32,
    	// Torque threshold for joint events
    	torqueThreshold:        f32,
    	// Constraint hertz (advanced feature)
    	constraintHertz:        f32,
    	// Constraint damping ratio (advanced feature)
    	constraintDampingRatio: f32,
    	// Debug draw scale
    	drawScale:              f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected:       bool,
    }
     

    Base joint definition used by all joint types. The local frames are measured from the body's origin rather than the center of mass because:

    1. you might not know where the center of mass will be.
    2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.

    JointEvent ¶

    JointEvent :: struct {
    	// The joint id
    	jointId:  JointId,
    	// The user data from the joint for convenience
    	userData: rawptr,
    }
     

    Joint events report joints that are awake and have a force and/or torque exceeding the threshold. The observed forces and torques are not returned for efficiency reasons.

    JointEvents ¶

    JointEvents :: struct {
    	// Array of events
    	jointEvents: [^]JointEvent,
    	// Number of events
    	count:       i32,
    }
     

    Joint events are buffered in the world and are available as event arrays after the time step is complete. Note: this data becomes invalid if joints are destroyed

    JointId ¶

    JointId :: struct {
    	index1:     i32,
    	world0:     u16,
    	generation: u16,
    }
     

    Joint id references a joint instance. This should be treated as an opaque handle.

    Related Procedures With Returns

    Related Constants

    JointType ¶

    JointType :: enum i32 {
    	// constrain the distance between two points
    	distanceJoint, 
    	// filter collision between two bodies
    	filterJoint, 
    	// fully control the movement of a body
    	motorJoint, 
    	// control the movement of the dynamic character mover
    	moverJoint, 
    	// ground interaction for the dynamic character mover
    	pogoJoint, 
    	// slide along an axis
    	prismaticJoint, 
    	// rotate around a pivot
    	revoluteJoint, 
    	// bring two bodies together with some flex
    	weldJoint, 
    	// wheel spins with shock absorber
    	wheelJoint, 
    }
     

    Joint type enumeration

    This is useful because all joint types use b2JointId and sometimes you want to get the type of a joint.

    LocalManifold ¶

    LocalManifold :: struct {
    	// The unit normal vector in frame A, points from shape A to shape B
    	normal:     [2]f32,
    	// The manifold points, up to two are possible in 2D
    	points:     [2]LocalManifoldPoint `fmt:"v,pointCount"`,
    	// The number of contact points, will be 0, 1, or 2
    	pointCount: i32,
    }
     

    Contact manifold in local coordinates (frame A).

    Related Procedures With Returns

    LocalManifoldPoint ¶

    LocalManifoldPoint :: struct {
    	// Contact point in frame A
    	point:      [2]f32,
    	// The separation of the contact point, negative if penetrating. May be positive or negative.
    	separation: f32,
    	// Uniquely identifies a contact point between two shapes
    	id:         u16,
    }
     

    Contact manifold point in local coordinates (frame A).

    LogCallbackFcn ¶

    LogCallbackFcn :: proc "c" (message: cstring)
     

    Prototype for user log callback. Used to log warnings.

    Manifold ¶

    Manifold :: struct {
    	// The unit normal vector in world space, points from shape A to shape B.
    	normal:         [2]f32,
    	// Angular impulse applied for rolling resistance. N * m * s = kg * m^2 / s
    	rollingImpulse: f32,
    	// The manifold points, up to two are possible in 2D.
    	points:         [2]ManifoldPoint `fmt:"v,pointCount"`,
    	// The number of contact points, will be 0, 1, or 2.
    	pointCount:     i32,
    }
     

    A contact manifold describes the contact points between colliding shapes. @note Box2D uses speculative collision so some contact points may be separated.

    ManifoldPoint ¶

    ManifoldPoint :: struct {
    	// Location of the contact point relative to bodyA's center of mass in world space. This can be
    	// converted to a world point using:
    	// b2Pos worldPointA = b2OffsetPos(b2Body_GetWorldCenter(myBodyIdA), anchorA);
    	anchorA:            [2]f32,
    	// Similar for body B.
    	anchorB:            [2]f32,
    	// The separation of the contact point, negative if penetrating
    	separation:         f32,
    	// The impulse along the manifold normal vector.
    	normalImpulse:      f32,
    	// The friction impulse
    	tangentImpulse:     f32,
    	// The total normal impulse applied across sub-stepping and restitution. This is important to
    	// identify speculative contact points that had an interaction in the time step. This includes
    	// the warm starting impulse, the sub-step delta impulse, and the restitution impulse.
    	totalNormalImpulse: f32,
    	// Relative normal velocity pre-solve. Negative when approaching. This is only computed if hit
    	// events are enabled. It may be computed otherwise as a side effect of SIMD bundling, but that
    	// is not guaranteed.
    	normalVelocity:     f32,
    	// Cached separation used for contact recycling
    	baseSeparation:     f32,
    	// Uniquely identifies a contact point between two shapes
    	id:                 u16,
    	// Did this contact point exist the previous step?
    	persisted:          bool,
    }
     

    A manifold point is a contact point belonging to a contact manifold. It holds details related to the geometry and dynamics of the contact points. Box2D uses speculative collision so some contact points may be separated. You may use the totalNormalImpulse to determine if there was an interaction during the time step.

    MassData ¶

    MassData :: struct {
    	// The mass of the shape, usually in kilograms.
    	mass:              f32,
    	// The position of the shape's centroid relative to the shape's origin.
    	center:            [2]f32,
    	// The rotational inertia of the shape about the shape center.
    	rotationalInertia: f32,
    }
     

    This holds the mass data computed for a shape.

    Related Procedures With Returns

    Mat22 ¶

    Mat22 :: matrix[2, 2]f32

    Related Procedures With Parameters

    Related Constants

    MotionLocks ¶

    MotionLocks :: struct {
    	// Prevent translation along the x-axis
    	linearX:  bool,
    	// Prevent translation along the y-axis
    	linearY:  bool,
    	// Prevent rotation around the z-axis
    	angularZ: bool,
    }
     

    Motion locks to restrict the body movement

    MotorJointDef ¶

    MotorJointDef :: struct {
    	// Base joint definition
    	using base:          JointDef,
    	// The desired linear velocity
    	linearVelocity:      [2]f32,
    	// The maximum motor force in newtons
    	maxVelocityForce:    f32,
    	// The desired angular velocity
    	angularVelocity:     f32,
    	// The maximum motor torque in newton-meters
    	maxVelocityTorque:   f32,
    	// Linear spring hertz for position control
    	linearHertz:         f32,
    	// Linear spring damping ratio
    	linearDampingRatio:  f32,
    	// Maximum spring force in newtons
    	maxSpringForce:      f32,
    	// Angular spring hertz for position control
    	angularHertz:        f32,
    	// Angular spring damping ratio
    	angularDampingRatio: f32,
    	// Maximum spring torque in newton-meters
    	maxSpringTorque:     f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:       i32,
    }
     

    A motor joint is used to control the relative velocity and/or transform between two bodies. With a velocity of zero this acts like top-down friction.

    Fields Through using (11)

    From using base: JointDef

    MoverJointDef ¶

    MoverJointDef :: struct {
    	// Base joint definition
    	using base:       JointDef,
    	// The desired linear velocity
    	linearVelocity:   [2]f32,
    	// The maximum motor force in newtons.
    	maxVelocityForce: [2]f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    A mover joint is used to move a dynamic character mover through velocity commands. The x and y directions are handled separately. Does not affect rotation.

    Fields Through using (11)

    From using base: JointDef

    OverlapResultCallbackFcn ¶

    OverlapResultCallbackFcn :: proc "c" (shapeId: ShapeId, userContext: rawptr) -> bool
     

    Prototype callback for overlap queries. Called for each shape found in the query. @see b2World_OverlapAABB @return false to terminate the query.

    Related Procedures With Parameters

    Plane ¶

    Plane :: struct {
    	normal: [2]f32,
    	offset: f32,
    }
     

    separation = dot(normal, point) - offset

    Related Procedures With Parameters

    PlaneResult ¶

    PlaneResult :: struct {
    	// The collision plane between the mover and a convex shape
    	plane: Plane,
    	// The collision point on the shape.
    	point: [2]f32,
    	// Did the collision register a hit? If not this plane should be ignored.
    	hit:   bool,
    }
     

    These are the collision planes returned from b2World_CollideMover. The plane and point are relative to the query origin, matching the mover capsule.

    PlaneResultCallbackFcn ¶

    PlaneResultCallbackFcn :: proc "c" (shapeId: ShapeId, plane: ^PlaneResult, userContext: rawptr) -> bool
     

    Used to collect collision planes for character movers. Return true to continue gathering planes.

    PlaneSolverResult ¶

    PlaneSolverResult :: struct {
    	// The final relative translation.
    	delta:          [2]f32,
    	// The number of iterations used by the plane solver. For diagnostics.
    	iterationCount: i32,
    }
     

    Result returned by b2SolvePlanes.

    PogoJointDef ¶

    PogoJointDef :: struct {
    	// Base joint definition
    	using base:          JointDef,
    	// Normal vector at the contact
    	normal:              [2]f32,
    	// The spring stiffness Hertz, cycles per second
    	hertz:               f32,
    	// The spring damping ratio, non-dimensional
    	dampingRatio:        f32,
    	// Spring length.
    	restLength:          f32,
    	// Maximum tension force. Controls how sticky the mover is to ground.
    	maxTensionForce:     f32,
    	// Maximum compression force. How hard the pogo pushes the mover up from the ground.
    	maxCompressionForce: f32,
    	// The initial pogo internal impulse. The pogo is typically recreated every frame. This gives a
    	// way to move the internal state forward for smoother spring behavior.
    	impulse:             f32,
    	// The initial pogo internal velocity. The pogo is typically recreated every frame. This gives
    	// a way to move the internal state forward for smoother spring behavior.
    	velocity:            f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:       i32,
    }
     

    Pogo joint definition

    Fields Through using (11)

    From using base: JointDef

    Polygon ¶

    Polygon :: struct {
    	// The polygon vertices
    	vertices: [8][2]f32 `fmt:"v,count"`,
    	// The outward normal vectors of the polygon sides
    	normals:  [8][2]f32 `fmt:"v,count"`,
    	// The centroid of the polygon
    	centroid: [2]f32,
    	// The external radius for rounded polygons
    	radius:   f32,
    	// The number of polygon vertices
    	count:    i32,
    }
     

    A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to B2_MAX_POLYGON_VERTICES. In most cases you should not need many vertices for a convex polygon. @warning DO NOT fill this out manually, instead use a helper function like b2MakePolygon or b2MakeBox.

    Related Procedures With Parameters

    Related Procedures With Returns

    Pos ¶

    Pos :: [2]f32
     

    A world position. This is an alias in single precision, and the bindings only support single precision.

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    PreContinuousCallbackFcn ¶

    PreContinuousCallbackFcn :: proc "c" (shapeIdA: ShapeId, shapeIdB: ShapeId, point: [2]f32, normal: [2]f32, userContext: rawptr) -> bool
     

    Prototype for a pre-continuous callback. This is called when a time of impact event is computed in continuous collision. This function can be used to skip the event. Unlike the pre-solve callback, this only supplies the point and normal. At this stage of the solver the manifold may not exist or may be stale. Notes:

    • this function must be thread-safe
    • this is only called if the shape has enabled pre-solve events
    • this is called only for awake dynamic bodies
    • this is not called for sensors Return false if you want to disable the time of impact event. @warning Do not attempt to modify the world inside this callback

    PreSolveCallbackFcn ¶

    PreSolveCallbackFcn :: proc "c" (shapeIdA: ShapeId, shapeIdB: ShapeId, manifold: ^Manifold, userContext: rawptr)
     

    Prototype for a pre-solve callback. This is called after a contact manifold is updated. This allows you to inspect a manifold before it goes to the solver. If you are careful, you can modify the manifold (e.g. modify the normal). You can set the manifold point count to zero to disable collision. Notes:

    • this function must be thread-safe
    • this is only called if the shape has enabled pre-solve events
    • this is called only for awake dynamic bodies
    • this is not called for sensors
    • the supplied manifold impulses are not reliable @warning Do not attempt to modify the world inside this callback

    PrismaticJointDef ¶

    PrismaticJointDef :: struct {
    	// Base joint definition
    	using base:        JointDef,
    	// Enable a linear spring along the prismatic joint axis
    	enableSpring:      bool,
    	// The spring stiffness Hertz, cycles per second
    	hertz:             f32,
    	// The spring damping ratio, non-dimensional
    	dampingRatio:      f32,
    	// The target translation for the joint in meters. The spring-damper will drive to this
    	// translation.
    	targetTranslation: f32,
    	// Enable/disable the joint limit
    	enableLimit:       bool,
    	// The lower translation limit
    	lowerTranslation:  f32,
    	// The upper translation limit
    	upperTranslation:  f32,
    	// Enable/disable the joint motor
    	enableMotor:       bool,
    	// The maximum motor force, typically in newtons
    	maxMotorForce:     f32,
    	// The desired motor speed, typically in meters per second
    	motorSpeed:        f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:     i32,
    }
     

    Prismatic joint definition Body B may slide along the x-axis in local frame A. Body B cannot rotate relative to body A. The joint translation is zero when the local frame origins coincide in world space.

    Fields Through using (11)

    From using base: JointDef

    Profile ¶

    Profile :: struct {
    	step:                f32,
    	pairs:               f32,
    	collide:             f32,
    	solve:               f32,
    	solverSetup:         f32,
    	constraints:         f32,
    	prepareConstraints:  f32,
    	integrateVelocities: f32,
    	warmStart:           f32,
    	solveImpulses:       f32,
    	integratePositions:  f32,
    	relaxImpulses:       f32,
    	restitution:         f32,
    	storeImpulses:       f32,
    	splitIslands:        f32,
    	transforms:          f32,
    	sensorHits:          f32,
    	jointEvents:         f32,
    	hitEvents:           f32,
    	refit:               f32,
    	bullets:             f32,
    	sleepIslands:        f32,
    	sensors:             f32,
    }
     

    Profiling data. Times are in milliseconds.

    QueryFilter ¶

    QueryFilter :: struct {
    	// The collision category bits of this query. Normally you would just set one bit.
    	categoryBits: u64,
    	// The collision mask bits. This states the shape categories that this query would accept for
    	// collision.
    	maskBits:     u64,
    }
     

    The query filter is used to filter collisions between queries and shapes. For example, you may want a ray-cast representing a projectile to hit players and the static environment but not debris.

    Related Procedures With Parameters

    RayCastInput ¶

    RayCastInput :: struct {
    	// Start point of the ray cast
    	origin:      [2]f32,
    	// Translation of the ray cast
    	translation: [2]f32,
    	// The maximum fraction of the translation to consider, typically 1
    	maxFraction: f32,
    }
     

    Low level ray cast input data

    Related Procedures With Parameters

    RayResult ¶

    RayResult :: struct {
    	// The shape hit.
    	shapeId:    ShapeId,
    	// The point of contact, on the surface of the hit shape.
    	point:      [2]f32,
    	// The unit normal vector at the point of contact.
    	normal:     [2]f32,
    	// The fraction of the input ray.
    	fraction:   f32,
    	// The number of BVH nodes visited. Diagnostic.
    	nodeVisits: i32,
    	// The number of BVH leaves visited. Diagnostic.
    	leafVisits: i32,
    	// Did the ray hit? If false, all other data is invalid.
    	hit:        bool,
    }
     

    Result from b2World_CastRayClosest If there is initial overlap the fraction and normal will be zero while the point is an arbitrary point in the overlap region.

    Recording ¶

    Recording :: struct {}
     

    Opaque handle for a recording buffer. Create one, hand it to b2World_StartRecording, then save its bytes and destroy it. The buffer grows as the world records into it.

    Related Procedures With Parameters

    Related Procedures With Returns

    ReplayInfo ¶

    ReplayInfo :: struct {
    	// total recorded steps
    	frameCount:   i32,
    	// worker count used for the replay world
    	workerCount:  i32,
    	// dt of the recorded steps
    	timeStep:     f32,
    	// recorded sub-steps
    	subStepCount: i32,
    	// length units per meter in effect when recorded
    	lengthScale:  f32,
    	// accumulated world bounds over the recording, zero-extent if unavailable
    	bounds:       AABB,
    }
     

    Static metadata describing a recording, resolved once when the player opens the file.

    ReplayQueryHit ¶

    ReplayQueryHit :: struct {
    	// the shape hit
    	shapeId:  ShapeId,
    	// the hit point on the shape surface
    	point:    [2]f32,
    	// the unit normal vector at the hit point
    	normal:   [2]f32,
    	// the query translation fraction
    	fraction: f32,
    }
     

    One result of a recorded spatial query.

    ReplayQueryInfo ¶

    ReplayQueryInfo :: struct {
    	// the query type
    	type:        ReplayQueryType,
    	// the query filter
    	filter:      QueryFilter,
    	// overlap AABB, relative to origin
    	aabb:        AABB,
    	// query origin
    	origin:      [2]f32,
    	// ray and cast translation
    	translation: [2]f32,
    	// number of recorded results
    	hitCount:    i32,
    }
     

    A spatial query recorded during a replayed frame, exposed for inspection.

    ReplayQueryType ¶

    ReplayQueryType :: enum i32 {
    	replayQueryOverlapAABB, 
    	replayQueryOverlapShape, 
    	replayQueryCastRay, 
    	replayQueryCastShape, 
    	replayQueryCollideMover, 
    	replayQueryCastRayClosest, 
    	replayQueryCastMover, 
    }
     

    The kind of a recorded spatial query, matching the public query and cast functions.

    RestitutionCallbackFcn ¶

    RestitutionCallbackFcn :: proc "c" (restitutionA: f32, userMaterialIdA: u64, restitutionB: f32, userMaterialIdB: u64) -> f32
     

    Optional restitution mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box2D state or user application state.

    RevoluteJointDef ¶

    RevoluteJointDef :: struct {
    	// Base joint definition
    	using base:     JointDef,
    	// The target angle for the joint in radians. The spring-damper will drive to this angle.
    	targetAngle:    f32,
    	// Enable a rotational spring on the revolute hinge axis
    	enableSpring:   bool,
    	// The spring stiffness Hertz, cycles per second
    	hertz:          f32,
    	// The spring damping ratio, non-dimensional
    	dampingRatio:   f32,
    	// A flag to enable joint limits
    	enableLimit:    bool,
    	// The lower angle for the joint limit in radians. Minimum of -0.99*pi radians.
    	lowerAngle:     f32,
    	// The upper angle for the joint limit in radians. Maximum of 0.99*pi radians.
    	upperAngle:     f32,
    	// A flag to enable the joint motor
    	enableMotor:    bool,
    	// The maximum motor torque, typically in newton-meters
    	maxMotorTorque: f32,
    	// The desired motor speed in radians per second
    	motorSpeed:     f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:  i32,
    }
     

    Revolute joint definition A point on body B is fixed to a point on body A. Allows relative rotation.

    Fields Through using (11)

    From using base: JointDef

    Segment ¶

    Segment :: struct {
    	// The first point
    	point1: [2]f32,
    	// The second point
    	point2: [2]f32,
    }
     

    A line segment with two-sided collision.

    Related Procedures With Parameters

    SegmentDistanceResult ¶

    SegmentDistanceResult :: struct {
    	// The closest point on the first segment
    	closest1:        [2]f32,
    	// The closest point on the second segment
    	closest2:        [2]f32,
    	// The barycentric coordinate on the first segment
    	fraction1:       f32,
    	// The barycentric coordinate on the second segment
    	fraction2:       f32,
    	// The squared distance between the closest points
    	distanceSquared: f32,
    }
     

    Result of computing the distance between two line segments

    SensorBeginTouchEvent ¶

    SensorBeginTouchEvent :: struct {
    	// The id of the sensor shape
    	sensorShapeId:  ShapeId,
    	// The id of the shape that began touching the sensor shape
    	visitorShapeId: ShapeId,
    }
     

    A begin touch event is generated when a shape starts to overlap a sensor shape.

    SensorEndTouchEvent ¶

    SensorEndTouchEvent :: struct {
    	// The id of the sensor shape
    	sensorShapeId:  ShapeId,
    	// The id of the shape that began touching the sensor shape
    	visitorShapeId: ShapeId,
    }
     

    An end touch event is generated when a shape stops overlapping a sensor shape. Normally this event is generated from simulation movement. However, this event can also be generated from API interactions: setting the body transform, destroying a body or shape, or changing a filter. You will also get an end event if the sensor is destroyed. Therefore you should always confirm the shape id is valid using b2Shape_IsValid.

    SensorEvents ¶

    SensorEvents :: struct {
    	// Array of sensor begin touch events
    	beginEvents: [^]SensorBeginTouchEvent `fmt:"v,beginCount"`,
    	// Array of sensor end touch events
    	endEvents:   [^]SensorEndTouchEvent `fmt:"v,endCount"`,
    	// The number of begin touch events
    	beginCount:  i32,
    	// The number of end touch events
    	endCount:    i32,
    }
     

    Sensor events are buffered in the world and are available as begin/end overlap event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed

    ShapeCastInput ¶

    ShapeCastInput :: struct {
    	// A generic shape
    	proxy:       ShapeProxy,
    	// The translation of the shape cast
    	translation: [2]f32,
    	// The maximum fraction of the translation to consider, typically 1
    	maxFraction: f32,
    	// Allow shape cast to encroach when initially touching. This only works if the radius is
    	// greater than zero.
    	canEncroach: bool,
    }
     

    Low level shape cast input in generic form. This allows casting an arbitrary point cloud wrapped with a radius. For example, a circle is a single point with a non-zero radius. A capsule is two points with a non-zero radius. A box is four points with a zero radius.

    Related Procedures With Parameters

    ShapeCastPairInput ¶

    ShapeCastPairInput :: struct {
    	// The proxy for shape A
    	proxyA:       ShapeProxy,
    	// The proxy for shape B
    	proxyB:       ShapeProxy,
    	// Transform of shape B in shape A's frame, the relative pose B in A
    	transform:    Transform,
    	// The translation of shape B, in A's frame
    	translationB: [2]f32,
    	// The fraction of the translation to consider, typically 1
    	maxFraction:  f32,
    	// Allows shapes with a radius to move slightly closer if already touching
    	canEncroach:  bool,
    }
     

    Input parameters for b2CastShape

    ShapeDef ¶

    ShapeDef :: struct {
    	// Use this to store application specific shape data.
    	userData:              rawptr,
    	// The surface material for this shape.
    	material:              SurfaceMaterial,
    	// The density, usually in kg/m^2. This is not part of the surface material because this is for
    	// the interior, which may have other considerations, such as being hollow. For example a wood
    	// barrel may be hollow or full of water.
    	density:               f32,
    	// Collision filtering data.
    	filter:                Filter,
    	// Enable custom filtering. Only one of the two shapes needs to enable custom filtering. See
    	// b2World_SetCustomFilterCallback.
    	enableCustomFiltering: bool,
    	// A sensor shape generates overlap events but never generates a collision response. Fast
    	// moving sensors may miss overlaps. Instead, use a ray or shape cast for those scenarios.
    	// Sensors still contribute to the body mass if they have non-zero density.
    	// @note Sensor events are disabled by default.
    	// @see enableSensorEvents
    	isSensor:              bool,
    	// Enable sensor events for this shape. This applies to sensors and non-sensors. Both shapes
    	// involved must have this flag set to true. False by default, even for sensors.
    	enableSensorEvents:    bool,
    	// Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Only one
    	// shape involved needs this flag set to true. Ignored for sensors. False by default.
    	enableContactEvents:   bool,
    	// Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Only one
    	// shape involved needs this flag set to true. Ignored for sensors. False by default.
    	enableHitEvents:       bool,
    	// Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are
    	// expensive and must be carefully handled due to multithreading. Ignored for sensors.
    	enablePreSolveEvents:  bool,
    	// When shapes are created they will scan the environment for collision the next time step.
    	// This can significantly slow down static body creation when there are many static shapes.
    	// This flag is ignored for dynamic and kinematic shapes which always invoke contact creation.
    	invokeContactCreation: bool,
    	// Should the body update the mass properties when this shape is created. Default is true.
    	// Warning: if this is false, you MUST call b2Body_UpdateMassFromShapes or b2Body_SetMassData
    	// before simulating the world.
    	updateBodyMass:        bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:         i32,
    }
     

    Used to create a shape. This is a temporary object used to bundle shape creation parameters. You may use the same shape definition to create multiple shapes. Must be initialized using b2DefaultShapeDef().

    Related Procedures With Parameters

    ShapeProxy ¶

    ShapeProxy :: struct {
    	// The point cloud
    	points: [8][2]f32 `fmt:"v,count"`,
    	// The number of points. Must be greater than 0.
    	count:  i32,
    	// The external radius of the point cloud. May be zero.
    	radius: f32,
    }
     

    A distance proxy is used by the GJK algorithm. It encapsulates any shape. You can provide between 1 and B2_MAX_POLYGON_VERTICES points and a radius.

    Related Procedures With Parameters

    Related Procedures With Returns

    ShapeType ¶

    ShapeType :: enum i32 {
    	// A circle with an offset
    	circleShape, 
    	// A capsule is an extruded circle
    	capsuleShape, 
    	// A line segment
    	segmentShape, 
    	// A convex polygon
    	polygonShape, 
    	// A line segment owned by a chain shape
    	chainSegmentShape, 
    	// The number of shape types
    	shapeTypeCount, 
    }
     

    Shape type

    Simplex ¶

    Simplex :: struct {
    	v1:    SimplexVertex,
    	v2:    SimplexVertex,
    	// vertices
    	v3:    SimplexVertex,
    	// number of valid vertices
    	count: i32,
    }
     

    Simplex from the GJK algorithm

    SimplexCache ¶

    SimplexCache :: struct {
    	// The number of stored simplex points
    	count:  u16,
    	// The cached simplex indices on shape A
    	indexA: [3]u8 `fmt:"v,count"`,
    	// The cached simplex indices on shape B
    	indexB: [3]u8 `fmt:"v,count"`,
    }
     

    Used to warm start the GJK simplex. If you call b2ComputeShapeDistance multiple times with nearby transforms this might improve performance. The distance cache must be initialized to zero on the first call.

    Related Procedures With Parameters

    SimplexVertex ¶

    SimplexVertex :: struct {
    	// support point in proxyA
    	wA:     [2]f32,
    	// support point in proxyB
    	wB:     [2]f32,
    	// wB - wA
    	w:      [2]f32,
    	// barycentric coordinate for closest point
    	a:      f32,
    	// wA index
    	indexA: i32,
    	// wB index
    	indexB: i32,
    }
     

    Simplex vertex for debugging the GJK algorithm

    SurfaceMaterial ¶

    SurfaceMaterial :: struct {
    	// The Coulomb (dry) friction coefficient, usually in the range [0,1].
    	friction:          f32,
    	// The coefficient of restitution (bounce) usually in the range [0,1].
    	// https://en.wikipedia.org/wiki/Coefficient_of_restitution
    	restitution:       f32,
    	// The rolling resistance usually in the range [0,1].
    	rollingResistance: f32,
    	// The tangent speed for conveyor belts
    	tangentSpeed:      f32,
    	// User material identifier. This is passed with query results and to friction and restitution
    	// combining functions. It is not used internally.
    	userMaterialId:    u64,
    	// Custom debug draw color.
    	customColor:       u32,
    }
     

    The surface material groups together parameters related to the shape surface, which is the 2D boundary. Surface materials allow chain shapes to have per segment properties.

    Related Procedures With Parameters

    Related Procedures With Returns

    Sweep ¶

    Sweep :: struct {
    	// Local center of mass position
    	localCenter: [2]f32,
    	// Starting center of mass world position
    	c1:          [2]f32,
    	// Ending center of mass world position
    	c2:          [2]f32,
    	// Starting world rotation
    	q1:          Rot,
    	// Ending world rotation
    	q2:          Rot,
    }
     

    This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.

    TOIInput ¶

    TOIInput :: struct {
    	// The proxy for shape A
    	proxyA:      ShapeProxy,
    	// The proxy for shape B
    	proxyB:      ShapeProxy,
    	// The movement of shape A
    	sweepA:      Sweep,
    	// The movement of shape B
    	sweepB:      Sweep,
    	// Defines the sweep interval [0, maxFraction]
    	maxFraction: f32,
    }
     

    Time of impact input

    TOIOutput ¶

    TOIOutput :: struct {
    	// The type of result
    	state:    TOIState,
    	// The hit point
    	point:    [2]f32,
    	// The hit normal
    	normal:   [2]f32,
    	// The sweep time of the collision
    	fraction: f32,
    }
     

    Time of impact output

    TOIState ¶

    TOIState :: enum i32 {
    	Unknown, 
    	Failed, 
    	Overlapped, 
    	Hit, 
    	Separated, 
    }
     

    Describes the TOI output

    TaskCallbackFcn ¶

    TaskCallbackFcn :: proc "c" (taskContext: rawptr)
     

    Task interface This is the prototype for a Box2D task. Your task system is expected to run this callback on a worker thread, exactly once per enqueue, passing back the same taskContext pointer supplied to b2EnqueueTaskCallbackFcn.

    TreeBoxCastCallbackFcn ¶

    TreeBoxCastCallbackFcn :: proc "c" (input: ^BoxCastInput, proxyId: i32, userData: u64, userContext: rawptr) -> f32
     

    This function receives clipped AABB cast input for a proxy. The function returns the new cast fraction.

    • return a value of 0 to terminate the cast
    • return a value less than input->maxFraction to clip the cast
    • return a value of input->maxFraction to continue the cast without clipping

    TreeQueryCallbackFcn ¶

    TreeQueryCallbackFcn :: proc "c" (proxyId: i32, userData: u64, userContext: rawptr) -> bool
     

    This function receives proxies found in the AABB query. @return true if the query should continue

    Related Procedures With Parameters

    TreeRayCastCallbackFcn ¶

    TreeRayCastCallbackFcn :: proc "c" (input: ^RayCastInput, proxyId: i32, userData: u64, userContext: rawptr) -> f32
     

    This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

    • return a value of 0 to terminate the ray cast
    • return a value less than input->maxFraction to clip the ray
    • return a value of input->maxFraction to continue the ray cast without clipping

    TreeStats ¶

    TreeStats :: struct {
    	// Number of internal nodes visited during the query
    	nodeVisits: i32,
    	// Number of leaf nodes visited during the query
    	leafVisits: i32,
    }
     

    These are performance results returned by dynamic tree queries.

    Related Procedures With Returns

    Vec2 ¶

    Vec2 :: [2]f32
    External examples raylib/box2d

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    Version ¶

    Version :: struct {
    	// Significant changes
    	major:    i32,
    	// Incremental changes
    	minor:    i32,
    	// Bug fixes
    	revision: i32,
    }
     

    Version numbering scheme. See https://semver.org/

    WeldJointDef ¶

    WeldJointDef :: struct {
    	// Base joint definition
    	using base:          JointDef,
    	// Linear stiffness expressed as Hertz (cycles per second). Use zero for maximum stiffness.
    	linearHertz:         f32,
    	// Angular stiffness as Hertz (cycles per second). Use zero for maximum stiffness.
    	angularHertz:        f32,
    	// Linear damping ratio, non-dimensional. Use 1 for critical damping.
    	linearDampingRatio:  f32,
    	// Angular damping ratio, non-dimensional. Use 1 for critical damping.
    	angularDampingRatio: f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:       i32,
    }
     

    Weld joint definition Connects two bodies together rigidly. This constraint provides springs to mimic soft-body simulation. @note The approximate solver in Box2D cannot hold many bodies together rigidly

    Fields Through using (11)

    From using base: JointDef

    WheelJointDef ¶

    WheelJointDef :: struct {
    	// Base joint definition
    	using base:       JointDef,
    	// Enable a linear spring along the local axis
    	enableSpring:     bool,
    	// Spring stiffness in Hertz
    	hertz:            f32,
    	// Spring damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Enable/disable the joint linear limit
    	enableLimit:      bool,
    	// The lower translation limit
    	lowerTranslation: f32,
    	// The upper translation limit
    	upperTranslation: f32,
    	// Enable/disable the joint rotational motor
    	enableMotor:      bool,
    	// The maximum motor torque, typically in newton-meters
    	maxMotorTorque:   f32,
    	// The desired motor speed in radians per second
    	motorSpeed:       f32,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Wheel joint definition Body B is a wheel that may rotate freely and slide along the local x-axis in frame A. The joint translation is zero when the local frame origins coincide in world space.

    Fields Through using (11)

    From using base: JointDef

    WorldCastOutput ¶

    WorldCastOutput :: CastOutput
     

    World-space cast output. The hit point is a world position. The normal stays a float direction.

    Related Procedures With Returns

    WorldDef ¶

    WorldDef :: struct {
    	// Gravity vector. Box2D has no up-vector defined.
    	gravity:                      [2]f32,
    	// Restitution speed threshold, usually in m/s. Collisions above this speed have restitution
    	// applied (will bounce).
    	restitutionThreshold:         f32,
    	// Number of iterations of the restitution solver. More iterations can lead to less box
    	// spinning.
    	// @see B2_MAX_RESTITUTION_ITERATIONS
    	restitutionIterations:        i32,
    	// Enable full contact propagation in the restitution solver. Expensive. (Experimental)
    	enableRestitutionPropagation: bool,
    	// Threshold speed for hit events. Usually meters per second.
    	hitEventThreshold:            f32,
    	// Contact stiffness. Cycles per second. Increasing this increases the speed of overlap
    	// recovery, but can introduce jitter.
    	contactHertz:                 f32,
    	// Contact bounciness. Non-dimensional. You can speed up overlap recovery by decreasing this
    	// with the trade-off that overlap resolution becomes more energetic.
    	contactDampingRatio:          f32,
    	// This parameter controls how fast overlap is resolved and usually has units of meters per
    	// second. This only puts a cap on the resolution speed. The resolution speed is increased by
    	// increasing the hertz and/or decreasing the damping ratio.
    	contactSpeed:                 f32,
    	// Maximum linear speed. Usually meters per second.
    	maximumLinearSpeed:           f32,
    	// Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB).
    	frictionCallback:             FrictionCallbackFcn,
    	// Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB).
    	restitutionCallback:          RestitutionCallbackFcn,
    	// Can bodies go to sleep to improve performance
    	enableSleep:                  bool,
    	// Enable continuous collision
    	enableContinuous:             bool,
    	// Number of workers for multithreading. Box2D performs best when using performance cores and
    	// accessing a single L3 cache (uniform memory). Efficiency cores and SMT provide little
    	// benefit and may even harm performance. This is clamped to the range [1, B2_MAX_WORKERS]. If
    	// task callbacks are provided then Box2D will use the user provided task system. If no task
    	// callbacks are installed then Box2D will run single-threaded with a worker count of 1, or use
    	// the internal scheduler with a worker count greater than 1.
    	workerCount:                  i32,
    	// Function to spawn tasks
    	enqueueTask:                  EnqueueTaskCallbackFcn,
    	// Function to finish a task
    	finishTask:                   FinishTaskCallbackFcn,
    	// User context that is provided to enqueueTask and finishTask
    	userTaskContext:              rawptr,
    	// User data
    	userData:                     rawptr,
    	// Optional initial capacities
    	capacity:                     Capacity,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:                i32,
    }
     

    World definition used to create a simulation world. Must be initialized using b2DefaultWorldDef().

    WorldId ¶

    WorldId :: struct {
    	index1:     u16,
    	generation: u16,
    }
     

    World id references a world instance. This should be treated as an opaque handle.

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    Constants

    AABB_MARGIN_FRACTION ¶

    AABB_MARGIN_FRACTION :: 0.125
     

    For small objects the margin is limited to this fraction times the maximum extent.

    CONTACT_RECYCLE_COS_ANGLE ¶

    CONTACT_RECYCLE_COS_ANGLE :: 0.98
     

    The default contact recycling world angle threshold. 0.98 ~= 11.5 degrees.

    DEFAULT_CATEGORY_BITS ¶

    DEFAULT_CATEGORY_BITS :: 1
     

    Default filter category bits.

    DEFAULT_MASK_BITS ¶

    DEFAULT_MASK_BITS: u64 : max(u64)
     

    Default filter mask bits.

    EPSILON ¶

    EPSILON :: math.F32_EPSILON

    GRAPH_COLOR_COUNT ¶

    GRAPH_COLOR_COUNT :: 24
     

    Maximum number of colors in the constraint graph. Constraints that cannot find a color are added to the overflow set, which is solved single-threaded.

    HASH_INIT ¶

    HASH_INIT :: 5381
     

    Starting hash value.

    MAX_POLYGON_VERTICES ¶

    MAX_POLYGON_VERTICES :: 8
     

    Maximum number of vertices of a convex polygon.

    MAX_RESTITUTION_ITERATIONS ¶

    MAX_RESTITUTION_ITERATIONS :: 63
     

    The maximum number of restitution iterations. Needed to avoid a solver overflow.

    MAX_ROTATION ¶

    MAX_ROTATION :: 0.25 * PI
     

    The maximum rotation of a body per time step. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.

    MAX_TASKS ¶

    MAX_TASKS :: 256
     

    Maximum number of tasks queued per world step. EnqueueTaskCallbackFcn will never be called more than this per world step. This is related to MAX_WORKERS. With 32 workers, the maximum observed task count is 130.

    MAX_WORKERS ¶

    MAX_WORKERS :: 32
     

    Maximum parallel workers. Used for some fixed size arrays.

    MAX_WORLDS ¶

    MAX_WORLDS :: 128
     

    Maximum number of simultaneous worlds that can be allocated.

    Mat22_zero ¶

    Mat22_zero: matrix[2, 2]f32 : Mat22{0, 0, 0, 0}

    NAME_LENGTH ¶

    NAME_LENGTH :: 10
     

    Maximum length of the body name.

    NULL_INDEX ¶

    NULL_INDEX :: -1
     

    An index that is not valid.

    TIME_TO_SLEEP ¶

    TIME_TO_SLEEP :: 0.5
     

    The time that a body must be still before it will go to sleep. In seconds.

    Transform_identity ¶

    Transform_identity :: Transform{{0, 0}, {1, 0}}

    VERSION_MAJOR ¶

    VERSION_MAJOR :: 3
     

    Version of the bindings, and the library they were made for.

    WorldTransform_identity ¶

    WorldTransform_identity: Transform : WorldTransform{{0, 0}, {1, 0}}

    nullContactId ¶

    nullContactId :: ContactId{}

    nullWorldId ¶

    nullWorldId :: WorldId{}
     

    Use these to make your identifiers null. You may also use zero initialization to get null.

    Variables

    This section is empty.

    Procedures

    AABB_Center ¶

    @(require_results)
    AABB_Center :: proc "c" (a: AABB) -> [2]f32 {…}
     

    Get the center of the AABB.

    AABB_Contains ¶

    @(require_results)
    AABB_Contains :: proc "c" (a, b: AABB) -> bool {…}
     

    Does a fully contain b

    AABB_Extents ¶

    @(require_results)
    AABB_Extents :: proc "c" (a: AABB) -> [2]f32 {…}
     

    Get the extents of the AABB (half-widths).

    AABB_Overlaps ¶

    @(require_results)
    AABB_Overlaps :: proc "c" (a, b: AABB) -> bool {…}
     

    Do a and b overlap

    AABB_Union ¶

    @(require_results)
    AABB_Union :: proc "c" (a, b: AABB) -> (c: AABB) {…}
     

    Union of two AABBs

    Abs ¶

    @(require_results)
    Abs :: proc "c" (a: [2]f32) -> (b: [2]f32) {…}
     

    Component-wise absolute vector

    AbsFloat ¶

    Deprecated. Prefer the built-in 'abs(a)'
    @(deprecated="Prefer the built-in 'abs(a)'")
    @(require_results)
    AbsFloat :: proc "c" (a: f32) -> f32 {…}
     

    @return the absolute value of a float

    AbsInt ¶

    Deprecated. Prefer the built-in 'abs(a)'
    @(deprecated="Prefer the built-in 'abs(a)'")
    @(require_results)
    AbsInt :: proc "c" (a: i32) -> i32 {…}
     

    @return the absolute value of an integer

    Add ¶

    Deprecated. Prefer 'a + b'
    @(deprecated="Prefer 'a + b'")
    @(require_results)
    Add :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Vector addition

    Atan2 ¶

    Atan2 :: proc "c" (y, x: f32) -> f32 ---
     

    Compute an approximate arctangent in the range [-pi, pi] This is hand coded for cross-platform determinism. The atan2f function in the standard library is not cross-platform deterministic. Accurate to around 0.0023 degrees

    Body_ApplyAngularImpulse ¶
    C · b2Body_ApplyAngularImpulseSource · box2d.odin:496

    Body_ApplyAngularImpulse :: proc "c" (bodyId: BodyId, impulse: f32, wake: bool) ---
     

    Apply an angular impulse. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the angular impulse, usually in units of kgmm/s @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady torque, use a torque instead, which will work better with the sub-stepping solver.

    Body_ApplyForce ¶
    C · b2Body_ApplyForceSource · box2d.odin:505

    Body_ApplyForce :: proc "c" (bodyId: BodyId, force: [2]f32, point: [2]f32, wake: bool) ---
     

    Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force The world force vector, usually in newtons (N) @param point The world position of the point of application @param wake Option to wake up the body

    Body_ApplyForceToCenter ¶
    C · b2Body_ApplyForceToCenterSource · box2d.odin:512

    Body_ApplyForceToCenter :: proc "c" (bodyId: BodyId, force: [2]f32, wake: bool) ---
     

    Apply a force to the center of mass. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force the world force vector, usually in newtons (N). @param wake also wake up the body

    Body_ApplyLinearImpulse ¶
    C · b2Body_ApplyLinearImpulseSource · box2d.odin:523

    Body_ApplyLinearImpulse :: proc "c" (
    	bodyId:  BodyId, 
    	impulse: [2]f32, 
    	point:   [2]f32, 
    	wake:    bool, 
    ) ---
     

    Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This optionally wakes the body. The impulse is ignored if the body is not awake. @param bodyId The body id @param impulse the world impulse vector, usually in Ns or kgm/s. @param point the world position of the point of application. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.

    Body_ApplyLinearImpulseToCenter ¶
    C · b2Body_ApplyLinearImpulseToCenterSource · box2d.odin:532

    Body_ApplyLinearImpulseToCenter :: proc "c" (bodyId: BodyId, impulse: [2]f32, wake: bool) ---
     

    Apply an impulse to the center of mass. This immediately modifies the velocity. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the world impulse vector, usually in Ns or kgm/s. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.

    Body_ApplyTorque ¶
    C · b2Body_ApplyTorqueSource · box2d.odin:539

    Body_ApplyTorque :: proc "c" (bodyId: BodyId, torque: f32, wake: bool) ---
     

    Apply a torque. This affects the angular velocity without affecting the linear velocity. This optionally wakes the body. The torque is ignored if the body is not awake. @param bodyId The body id @param torque about the z-axis (out of the screen), usually in N*m. @param wake also wake up the body

    Body_ClearForces ¶
    C · b2Body_ClearForcesSource · box2d.odin:545

    Body_ClearForces :: proc "c" (bodyId: BodyId) ---
     

    Clear the force and torque on this body. Forces and torques are automatically cleared after each world step. So this only needs to be called if the application wants to remove the effect of previous calls to apply forces and torques before the world step is called. @param bodyId The body id

    Body_ComputeBounds ¶
    C · b2Body_ComputeBoundsSource · box2d.odin:550

    Body_ComputeBounds :: proc "c" (bodyId: BodyId) -> AABB ---
     

    Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin. If there are no shapes attached then the returned AABB is empty and centered on the body origin.

    Body_Disable ¶
    C · b2Body_DisableSource · box2d.odin:553

    Body_Disable :: proc "c" (bodyId: BodyId) ---
     

    Disable a body by removing it completely from the simulation. This is expensive.

    Body_Enable ¶
    C · b2Body_EnableSource · box2d.odin:556

    Body_Enable :: proc "c" (bodyId: BodyId) ---
     

    Enable a body by adding it to the simulation. This is expensive.

    Body_EnableContactEvents ¶
    C · b2Body_EnableContactEventsSource · box2d.odin:561

    Body_EnableContactEvents :: proc "c" (bodyId: BodyId, flag: bool) ---
     

    Enable/disable contact events on all shapes. @see b2ShapeDef::enableContactEvents @warning changing this at runtime may cause mismatched begin/end touch events

    Body_EnableContactRecycling ¶
    C · b2Body_EnableContactRecyclingSource · box2d.odin:569

    Body_EnableContactRecycling :: proc "c" (bodyId: BodyId, flag: bool) ---
     

    Enable or disable contact recycling for this body. Contact recycling is a performance optimization that reuses contact manifolds when bodies move slightly. Disabling it can avoid ghost collisions on characters at the cost of higher per-step work. Existing contacts retain their prior setting; only contacts created after this call see the new value. @see b2BodyDef::enableContactRecycling

    Body_EnableHitEvents ¶
    C · b2Body_EnableHitEventsSource · box2d.odin:573

    Body_EnableHitEvents :: proc "c" (bodyId: BodyId, flag: bool) ---
     

    Enable/disable hit events on all shapes @see b2ShapeDef::enableHitEvents

    Body_EnableSleeping ¶
    C · b2Body_EnableSleepingSource · box2d.odin:577

    Body_EnableSleeping :: proc "c" (bodyId: BodyId, enableSleep: bool) ---
     

    Enable or disable sleeping for this body. If sleeping is disabled the body will wake (and the entire island).

    Body_GetAngularDamping ¶
    C · b2Body_GetAngularDampingSource · box2d.odin:580

    Body_GetAngularDamping :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the current angular damping.

    Body_GetAngularVelocity ¶
    C · b2Body_GetAngularVelocitySource · box2d.odin:583

    Body_GetAngularVelocity :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the angular velocity of a body in radians per second

    Body_GetContactCapacity ¶
    C · b2Body_GetContactCapacitySource · box2d.odin:586

    Body_GetContactCapacity :: proc "c" (bodyId: BodyId) -> i32 ---
     

    Get the maximum capacity required for retrieving all the touching contacts on a body

    Body_GetContactData ¶

    @(require_results)
    Body_GetContactData :: proc "c" (bodyId: BodyId, contactData: []ContactData) -> []ContactData {…}
     

    Get the touching contact data for a body. @note Box2D uses speculative collision so some contact points may be separated. @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements

    Body_GetGravityScale ¶
    C · b2Body_GetGravityScaleSource · box2d.odin:589

    Body_GetGravityScale :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the current gravity scale

    Body_GetJointCount ¶
    C · b2Body_GetJointCountSource · box2d.odin:592

    Body_GetJointCount :: proc "c" (bodyId: BodyId) -> i32 ---
     

    Get the number of joints on this body

    Body_GetJoints ¶

    @(require_results)
    Body_GetJoints :: proc "c" (bodyId: BodyId, jointArray: []JointId) -> []JointId {…}
     

    Get the joint ids for all joints on this body, up to the provided capacity @returns the number of joint ids stored in the user array

    Body_GetLinearDamping ¶
    C · b2Body_GetLinearDampingSource · box2d.odin:595

    Body_GetLinearDamping :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the current linear damping.

    Body_GetLinearVelocity ¶
    C · b2Body_GetLinearVelocitySource · box2d.odin:598

    Body_GetLinearVelocity :: proc "c" (bodyId: BodyId) -> [2]f32 ---
     

    Get the linear velocity of a body's center of mass. Usually in meters per second.

    Body_GetLocalCenter ¶
    C · b2Body_GetLocalCenterSource · box2d.odin:601

    Body_GetLocalCenter :: proc "c" (bodyId: BodyId) -> [2]f32 ---
     

    Get the center of mass position of the body in local space.

    Body_GetLocalPoint ¶
    C · b2Body_GetLocalPointSource · box2d.odin:604

    Body_GetLocalPoint :: proc "c" (bodyId: BodyId, worldPoint: [2]f32) -> [2]f32 ---
     

    Get a local point on a body given a world point

    Body_GetLocalPointVelocity ¶
    C · b2Body_GetLocalPointVelocitySource · box2d.odin:607

    Body_GetLocalPointVelocity :: proc "c" (bodyId: BodyId, localPoint: [2]f32) -> [2]f32 ---
     

    Get the linear velocity of a local point attached to a body. Usually in meters per second.

    Body_GetLocalVector ¶
    C · b2Body_GetLocalVectorSource · box2d.odin:610

    Body_GetLocalVector :: proc "c" (bodyId: BodyId, worldVector: [2]f32) -> [2]f32 ---
     

    Get a local vector on a body given a world vector

    Body_GetMass ¶
    C · b2Body_GetMassSource · box2d.odin:613

    Body_GetMass :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the mass of the body, usually in kilograms

    Body_GetMassData ¶
    C · b2Body_GetMassDataSource · box2d.odin:616

    Body_GetMassData :: proc "c" (bodyId: BodyId) -> MassData ---
     

    Get the mass data for a body

    Body_GetMaxExtent ¶
    C · b2Body_GetMaxExtentSource · box2d.odin:619

    Body_GetMaxExtent :: proc "c" (bodyId: BodyId) -> f32 ---
     

    The maximum distance from any point on the body shapes to the center of mass.

    Body_GetMaxExtentFromOrigin ¶
    C · b2Body_GetMaxExtentFromOriginSource · box2d.odin:622

    Body_GetMaxExtentFromOrigin :: proc "c" (bodyId: BodyId) -> f32 ---
     

    The maximum distance from any point on the body shapes to the body origin. Conservative.

    Body_GetMinExtent ¶
    C · b2Body_GetMinExtentSource · box2d.odin:625

    Body_GetMinExtent :: proc "c" (bodyId: BodyId) -> f32 ---
     

    The minimum distance from any point on the body shapes to the center of mass.

    Body_GetMotionLocks ¶
    C · b2Body_GetMotionLocksSource · box2d.odin:628

    Body_GetMotionLocks :: proc "c" (bodyId: BodyId) -> MotionLocks ---
     

    Get the motion locks for this body.

    Body_GetName ¶
    C · b2Body_GetNameSource · box2d.odin:631

    Body_GetName :: proc "c" (bodyId: BodyId) -> cstring ---
     

    Get the body name.

    Body_GetPosition ¶
    C · b2Body_GetPositionSource · box2d.odin:634

    Body_GetPosition :: proc "c" (bodyId: BodyId) -> [2]f32 ---
     

    Get the world position of a body. This is the location of the body origin.

    Body_GetRotation ¶
    C · b2Body_GetRotationSource · box2d.odin:637

    Body_GetRotation :: proc "c" (bodyId: BodyId) -> Rot ---
     

    Get the world rotation of a body as a cosine/sine pair (complex number)

    External examples raylib/box2d

    Body_GetRotationalInertia ¶
    C · b2Body_GetRotationalInertiaSource · box2d.odin:640

    Body_GetRotationalInertia :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the rotational inertia of the body, usually in kg*m^2

    Body_GetSafetyFactor ¶
    C · b2Body_GetSafetyFactorSource · box2d.odin:643

    Body_GetSafetyFactor :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the continuous collision safety factor. Non-dimensional.

    Body_GetShapeCount ¶
    C · b2Body_GetShapeCountSource · box2d.odin:646

    Body_GetShapeCount :: proc "c" (bodyId: BodyId) -> i32 ---
     

    Get the number of shapes on this body

    Body_GetShapes ¶

    @(require_results)
    Body_GetShapes :: proc "c" (bodyId: BodyId, shapeArray: []ShapeId) -> []ShapeId {…}
     

    Get the shape ids for all shapes on this body, up to the provided capacity. @returns the number of shape ids stored in the user array

    Body_GetSleepThreshold ¶
    C · b2Body_GetSleepThresholdSource · box2d.odin:649

    Body_GetSleepThreshold :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the sleep threshold, usually in meters per second.

    Body_GetTransform ¶
    C · b2Body_GetTransformSource · box2d.odin:652

    Body_GetTransform :: proc "c" (bodyId: BodyId) -> Transform ---
     

    Get the world transform of a body.

    Body_GetType ¶
    C · b2Body_GetTypeSource · box2d.odin:655

    Body_GetType :: proc "c" (bodyId: BodyId) -> BodyType ---
     

    Get the body type: static, kinematic, or dynamic

    Body_GetUserData ¶
    C · b2Body_GetUserDataSource · box2d.odin:658

    Body_GetUserData :: proc "c" (bodyId: BodyId) -> rawptr ---
     

    Get the user data stored in a body

    Body_GetWorld ¶
    C · b2Body_GetWorldSource · box2d.odin:661

    Body_GetWorld :: proc "c" (bodyId: BodyId) -> WorldId ---
     

    Get the world that owns this body

    Body_GetWorldCenter ¶
    C · b2Body_GetWorldCenterSource · box2d.odin:664

    Body_GetWorldCenter :: proc "c" (bodyId: BodyId) -> [2]f32 ---
     

    Get the center of mass position of the body in world space.

    Body_GetWorldPoint ¶
    C · b2Body_GetWorldPointSource · box2d.odin:667

    Body_GetWorldPoint :: proc "c" (bodyId: BodyId, localPoint: [2]f32) -> [2]f32 ---
     

    Get a world point on a body given a local point

    External examples raylib/box2d

    Body_GetWorldPointVelocity ¶
    C · b2Body_GetWorldPointVelocitySource · box2d.odin:670

    Body_GetWorldPointVelocity :: proc "c" (bodyId: BodyId, worldPoint: [2]f32) -> [2]f32 ---
     

    Get the linear velocity of a world point attached to a body. Usually in meters per second.

    Body_GetWorldVector ¶
    C · b2Body_GetWorldVectorSource · box2d.odin:673

    Body_GetWorldVector :: proc "c" (bodyId: BodyId, localVector: [2]f32) -> [2]f32 ---
     

    Get a world vector on a body given a local vector

    Body_IsAwake ¶
    C · b2Body_IsAwakeSource · box2d.odin:676

    Body_IsAwake :: proc "c" (bodyId: BodyId) -> bool ---
     

    @return true if this body is awake

    Body_IsBullet ¶
    C · b2Body_IsBulletSource · box2d.odin:679

    Body_IsBullet :: proc "c" (bodyId: BodyId) -> bool ---
     

    Is this body a bullet?

    Body_IsContactRecyclingEnabled ¶
    C · b2Body_IsContactRecyclingEnabledSource · box2d.odin:682

    Body_IsContactRecyclingEnabled :: proc "c" (bodyId: BodyId) -> bool ---
     

    Is contact recycling enabled on this body?

    Body_IsEnabled ¶
    C · b2Body_IsEnabledSource · box2d.odin:685

    Body_IsEnabled :: proc "c" (bodyId: BodyId) -> bool ---
     

    Returns true if this body is enabled

    Body_IsSleepingEnabled ¶
    C · b2Body_IsSleepingEnabledSource · box2d.odin:688

    Body_IsSleepingEnabled :: proc "c" (bodyId: BodyId) -> bool ---
     

    Returns true if sleeping is enabled for this body

    Body_IsValid ¶
    C · b2Body_IsValidSource · box2d.odin:692

    Body_IsValid :: proc "c" (id: BodyId) -> bool ---
     

    Body identifier validation. A valid body exists in a world and is non-null. This can be used to detect orphaned ids. Provides validation for up to 64K allocations.

    Body_SetAngularDamping ¶
    C · b2Body_SetAngularDampingSource · box2d.odin:695

    Body_SetAngularDamping :: proc "c" (bodyId: BodyId, angularDamping: f32) ---
     

    Adjust the angular damping. Normally this is set in b2BodyDef before creation.

    Body_SetAngularVelocity ¶
    C · b2Body_SetAngularVelocitySource · box2d.odin:698

    Body_SetAngularVelocity :: proc "c" (bodyId: BodyId, angularVelocity: f32) ---
     

    Set the angular velocity of a body in radians per second

    Body_SetAwake ¶
    C · b2Body_SetAwakeSource · box2d.odin:703

    Body_SetAwake :: proc "c" (bodyId: BodyId, awake: bool) ---
     

    Wake a body from sleep. This wakes the entire island the body is touching. @warning Putting a body to sleep will put the entire island of bodies touching this body to sleep, which can be expensive and possibly unintuitive.

    Body_SetBullet ¶
    C · b2Body_SetBulletSource · box2d.odin:707

    Body_SetBullet :: proc "c" (bodyId: BodyId, flag: bool) ---
     

    Set this body to be a bullet. A bullet does continuous collision detection against dynamic and kinematic bodies (but not other bullets). This only works on dynamic bodies.

    Body_SetGravityScale ¶
    C · b2Body_SetGravityScaleSource · box2d.odin:711

    Body_SetGravityScale :: proc "c" (bodyId: BodyId, gravityScale: f32) ---
     

    Adjust the gravity scale. Normally this is set in b2BodyDef before creation. @see b2BodyDef::gravityScale

    Body_SetLinearDamping ¶
    C · b2Body_SetLinearDampingSource · box2d.odin:714

    Body_SetLinearDamping :: proc "c" (bodyId: BodyId, linearDamping: f32) ---
     

    Adjust the linear damping. Normally this is set in b2BodyDef before creation.

    Body_SetLinearVelocity ¶
    C · b2Body_SetLinearVelocitySource · box2d.odin:717

    Body_SetLinearVelocity :: proc "c" (bodyId: BodyId, linearVelocity: [2]f32) ---
     

    Set the linear velocity of a body. Usually in meters per second.

    Body_SetMassData ¶
    C · b2Body_SetMassDataSource · box2d.odin:723

    Body_SetMassData :: proc "c" (bodyId: BodyId, massData: MassData) ---
     

    Override the body's mass properties. Normally this is computed automatically using the shape geometry and density. This information is lost if a shape is added or removed or if the body type changes. If motion locks are used to fix rotation then the rotational inertia value is ignored and rotational inertia remains fixed at zero.

    Body_SetMotionLocks ¶
    C · b2Body_SetMotionLocksSource · box2d.odin:727

    Body_SetMotionLocks :: proc "c" (bodyId: BodyId, locks: MotionLocks) ---
     

    Set the motion locks on this body. This causes mass properties to be recomputed because fixed rotation sets the rotational inertia to zero.

    Body_SetName ¶
    C · b2Body_SetNameSource · box2d.odin:730

    Body_SetName :: proc "c" (bodyId: BodyId, name: cstring) ---
     

    Set the body name. See B2_NAME_LENGTH.

    Body_SetSafetyFactor ¶
    C · b2Body_SetSafetyFactorSource · box2d.odin:734

    Body_SetSafetyFactor :: proc "c" (bodyId: BodyId, safetyFactor: f32) ---
     

    Set the continuous collision safety factor. Smaller is safer but can lead to hitching. Recommended range [0.01, 0.5]. Non-dimensional.

    Body_SetSleepThreshold ¶
    C · b2Body_SetSleepThresholdSource · box2d.odin:737

    Body_SetSleepThreshold :: proc "c" (bodyId: BodyId, sleepThreshold: f32) ---
     

    Set the sleep threshold, usually in meters per second

    Body_SetTargetTransform ¶
    C · b2Body_SetTargetTransformSource · box2d.odin:746

    Body_SetTargetTransform :: proc "c" (
    	bodyId:   BodyId, 
    	target:   Transform, 
    	timeStep: f32, 
    	wake:     bool, 
    ) ---
     

    Set the velocity to reach the given transform after a given time step. The result will be close but may not be exact. This is meant for kinematic bodies. The target is not applied if the velocity would be below the sleep threshold and the body is currently asleep. @param bodyId The body id @param target The target transform for the body @param timeStep The time step of the next call to b2World_Step @param wake Option to wake the body or not

    Body_SetTransform ¶
    C · b2Body_SetTransformSource · box2d.odin:751

    Body_SetTransform :: proc "c" (bodyId: BodyId, position: [2]f32, rotation: Rot) ---
     

    Set the world transform of a body. This acts as a teleport and is fairly expensive. @note Generally you should create a body with the intended transform. @see b2BodyDef::position and b2BodyDef::rotation

    Body_SetType ¶
    C · b2Body_SetTypeSource · box2d.odin:755

    Body_SetType :: proc "c" (bodyId: BodyId, type: BodyType) ---
     

    Change the body type. This is an expensive operation. This automatically updates the mass properties regardless of the automatic mass setting.

    Body_SetUserData ¶
    C · b2Body_SetUserDataSource · box2d.odin:758

    Body_SetUserData :: proc "c" (bodyId: BodyId, userData: rawptr) ---
     

    Set the user data for a body

    Body_UpdateMassFromShapes ¶
    C · b2Body_UpdateMassFromShapesSource · box2d.odin:764

    Body_UpdateMassFromShapes :: proc "c" (bodyId: BodyId) ---
     

    This updates the mass properties to the sum of the mass properties of the shapes. This normally does not need to be called unless you called b2Body_SetMassData to override the mass and you later want to reset the mass. You may also use this when automatic mass computation has been disabled. You should call this regardless of body type. Note that sensor shapes may have mass.

    Body_WakeTouching ¶
    C · b2Body_WakeTouchingSource · box2d.odin:767

    Body_WakeTouching :: proc "c" (bodyId: BodyId) ---
     

    Wake bodies touching this body. Works for static bodies.

    CONTACT_RECYCLE_DISTANCE ¶

    @(require_results)
    CONTACT_RECYCLE_DISTANCE :: proc "c" () -> f32 {…}
     

    The default contact recycling distance.

    CastRayCapsule ¶
    C · b2CastRayCapsuleSource · box2d.odin:20

    CastRayCapsule :: proc "c" (#by_ptr shape: Capsule, #by_ptr input: RayCastInput) -> CastOutput ---
     

    Ray cast versus capsule shape in local space.

    CastRayCircle ¶
    C · b2CastRayCircleSource · box2d.odin:23

    CastRayCircle :: proc "c" (#by_ptr shape: Circle, #by_ptr input: RayCastInput) -> CastOutput ---
     

    Ray cast versus circle shape in local space.

    CastRayPolygon ¶
    C · b2CastRayPolygonSource · box2d.odin:26

    CastRayPolygon :: proc "c" (#by_ptr shape: Polygon, #by_ptr input: RayCastInput) -> CastOutput ---
     

    Ray cast versus polygon shape in local space.

    CastRaySegment ¶
    C · b2CastRaySegmentSource · box2d.odin:30

    CastRaySegment :: proc "c" (
    	#by_ptr shape: Segment, 
    	#by_ptr input: RayCastInput, 
    	oneSided: bool, 
    ) -> CastOutput ---
     

    Ray cast versus segment shape in local space. Optionally treat the segment as one-sided with hits from the left side being treated as a miss.

    CastShape ¶
    C · b2CastShapeSource · box2d.odin:35

    CastShape :: proc "c" (#by_ptr input: ShapeCastPairInput) -> CastOutput ---
     

    Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction. The query runs in frame A, so the hit point and normal are returned in frame A. Initially touching shapes return a zero fraction in the output.

    CastShapeCapsule ¶
    C · b2CastShapeCapsuleSource · box2d.odin:38

    CastShapeCapsule :: proc "c" (
    	#by_ptr shape: Capsule, 
    	#by_ptr input: ShapeCastInput, 
    ) -> CastOutput ---
     

    Shape cast versus a capsule.

    CastShapeCircle ¶
    C · b2CastShapeCircleSource · box2d.odin:41

    CastShapeCircle :: proc "c" (
    	#by_ptr shape: Circle, 
    	#by_ptr input: ShapeCastInput, 
    ) -> CastOutput ---
     

    Shape cast versus a circle.

    CastShapePolygon ¶
    C · b2CastShapePolygonSource · box2d.odin:44

    CastShapePolygon :: proc "c" (
    	#by_ptr shape: Polygon, 
    	#by_ptr input: ShapeCastInput, 
    ) -> CastOutput ---
     

    Shape cast versus a convex polygon.

    CastShapeSegment ¶
    C · b2CastShapeSegmentSource · box2d.odin:47

    CastShapeSegment :: proc "c" (
    	#by_ptr shape: Segment, 
    	#by_ptr input: ShapeCastInput, 
    ) -> CastOutput ---
     

    Shape cast versus a line segment.

    CeilingInt ¶

    @(require_results)
    CeilingInt :: proc "c" (numerator, denominator: i32) -> i32 {…}
     

    https://en.wikipedia.org/wiki/Floor_and_ceiling_functions

    Chain_GetSegmentCount ¶
    C · b2Chain_GetSegmentCountSource · box2d.odin:774

    Chain_GetSegmentCount :: proc "c" (chainId: ChainId) -> i32 ---
     

    Get the number of segments on this chain

    Chain_GetSegments ¶

    @(require_results)
    Chain_GetSegments :: proc "c" (chainId: ChainId, segmentArray: []ShapeId) -> []ShapeId {…}
     

    Fill a user array with chain segment shape ids up to the specified capacity. Returns the actual number of segments returned.

    Chain_GetSurfaceMaterial ¶
    C · b2Chain_GetSurfaceMaterialSource · box2d.odin:777

    Chain_GetSurfaceMaterial :: proc "c" (chainId: ChainId, segmentIndex: i32) -> SurfaceMaterial ---
     

    Get a chain material by segment index.

    Chain_GetWorld ¶
    C · b2Chain_GetWorldSource · box2d.odin:780

    Chain_GetWorld :: proc "c" (chainId: ChainId) -> WorldId ---
     

    Get the world that owns this chain shape

    Chain_IsValid ¶
    C · b2Chain_IsValidSource · box2d.odin:783

    Chain_IsValid :: proc "c" (id: ChainId) -> bool ---
     

    Chain identifier validation. Provides validation for up to 64K allocations.

    Chain_SetAllSurfaceMaterials ¶
    C · b2Chain_SetAllSurfaceMaterialsSource · box2d.odin:786

    Chain_SetAllSurfaceMaterials :: proc "c" (chainId: ChainId, #by_ptr material: SurfaceMaterial) ---
     

    Set the chain material on all segments.

    Chain_SetSurfaceMaterial ¶
    C · b2Chain_SetSurfaceMaterialSource · box2d.odin:789

    Chain_SetSurfaceMaterial :: proc "c" (
    	chainId:      ChainId, 
    	#by_ptr material: SurfaceMaterial, 
    	segmentIndex: i32, 
    ) ---
     

    Set a chain material by segment index.

    Clamp ¶

    @(require_results)
    Clamp :: proc "c" (v: [2]f32, a, b: [2]f32) -> (c: [2]f32) {…}
     

    Component-wise clamp vector v into the range [a, b]

    ClampFloat ¶

    Deprecated. Prefer the built-in 'clamp(a, lower, upper)'
    @(deprecated="Prefer the built-in 'clamp(a, lower, upper)'")
    @(require_results)
    ClampFloat :: proc "c" (a, lower, upper: f32) -> f32 {…}
     

    @return a f32 clamped between a lower and upper bound

    ClampInt ¶

    Deprecated. Prefer the built-in 'clamp(a, lower, upper)'
    @(deprecated="Prefer the built-in 'clamp(a, lower, upper)'")
    @(require_results)
    ClampInt :: proc "c" (a, lower, upper: i32) -> i32 {…}
     

    @return an integer clamped between a lower and upper bound

    ClipVector ¶
    C · b2ClipVectorSource · box2d.odin:51

    ClipVector :: proc "c" (vector: [2]f32, planes: [^]CollisionPlane, count: i32) -> [2]f32 ---
     

    Clips the velocity against the given collision planes. Planes with zero push or clipVelocity set to false are skipped.

    CollideCapsuleAndCircle ¶
    C · b2CollideCapsuleAndCircleSource · box2d.odin:54

    CollideCapsuleAndCircle :: proc "c" (
    	#by_ptr capsuleA: Capsule, 
    	#by_ptr circleB: Circle, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a capsule and circle

    CollideCapsules ¶
    C · b2CollideCapsulesSource · box2d.odin:57

    CollideCapsules :: proc "c" (
    	#by_ptr capsuleA: Capsule, 
    	#by_ptr capsuleB: Capsule, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between two capsules

    CollideChainSegmentAndCapsule ¶
    C · b2CollideChainSegmentAndCapsuleSource · box2d.odin:60

    CollideChainSegmentAndCapsule :: proc "c" (
    	#by_ptr segmentA: ChainSegment, 
    	#by_ptr capsuleB: Capsule, 
    	xf:       Transform, 
    	cache:    ^SimplexCache, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a chain segment and a capsule

    CollideChainSegmentAndCircle ¶
    C · b2CollideChainSegmentAndCircleSource · box2d.odin:63

    CollideChainSegmentAndCircle :: proc "c" (
    	#by_ptr segmentA: ChainSegment, 
    	#by_ptr circleB: Circle, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a chain segment and a circle

    CollideChainSegmentAndPolygon ¶
    C · b2CollideChainSegmentAndPolygonSource · box2d.odin:66

    CollideChainSegmentAndPolygon :: proc "c" (
    	#by_ptr segmentA: ChainSegment, 
    	#by_ptr polygonB: Polygon, 
    	xf:       Transform, 
    	cache:    ^SimplexCache, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a chain segment and a rounded polygon

    CollideCircles ¶
    C · b2CollideCirclesSource · box2d.odin:69

    CollideCircles :: proc "c" (
    	#by_ptr circleA: Circle, 
    	#by_ptr circleB: Circle, 
    	xf:      Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between two circles

    CollidePolygonAndCapsule ¶
    C · b2CollidePolygonAndCapsuleSource · box2d.odin:72

    CollidePolygonAndCapsule :: proc "c" (
    	#by_ptr polygonA: Polygon, 
    	#by_ptr capsuleB: Capsule, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a polygon and capsule

    CollidePolygonAndCircle ¶
    C · b2CollidePolygonAndCircleSource · box2d.odin:75

    CollidePolygonAndCircle :: proc "c" (
    	#by_ptr polygonA: Polygon, 
    	#by_ptr circleB: Circle, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a polygon and a circle

    CollidePolygons ¶
    C · b2CollidePolygonsSource · box2d.odin:78

    CollidePolygons :: proc "c" (
    	#by_ptr polygonA: Polygon, 
    	#by_ptr polygonB: Polygon, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between two polygons

    CollideSegmentAndCapsule ¶
    C · b2CollideSegmentAndCapsuleSource · box2d.odin:81

    CollideSegmentAndCapsule :: proc "c" (
    	#by_ptr segmentA: Segment, 
    	#by_ptr capsuleB: Capsule, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a segment and a capsule

    CollideSegmentAndCircle ¶
    C · b2CollideSegmentAndCircleSource · box2d.odin:84

    CollideSegmentAndCircle :: proc "c" (
    	#by_ptr segmentA: Segment, 
    	#by_ptr circleB: Circle, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a segment and a circle

    CollideSegmentAndPolygon ¶
    C · b2CollideSegmentAndPolygonSource · box2d.odin:87

    CollideSegmentAndPolygon :: proc "c" (
    	#by_ptr segmentA: Segment, 
    	#by_ptr polygonB: Polygon, 
    	xf:       Transform, 
    ) -> LocalManifold ---
     

    Compute the contact manifold between a segment and a polygon

    ComputeAngularVelocity ¶

    @(require_results)
    ComputeAngularVelocity :: proc "c" (q1: Rot, q2: Rot, inv_h: f32) -> f32 {…}
     

    Compute the angular velocity necessary to rotate between two rotations over a given time

    @param q1 initial rotation
    @param q2 final rotation
    @param inv_h inverse time step
    

    ComputeCapsuleBounds ¶
    C · b2ComputeCapsuleBoundsSource · box2d.odin:90

    ComputeCapsuleBounds :: proc "c" (#by_ptr shape: Capsule, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed capsule

    ComputeCapsuleMass ¶
    C · b2ComputeCapsuleMassSource · box2d.odin:93

    ComputeCapsuleMass :: proc "c" (#by_ptr shape: Capsule, density: f32) -> MassData ---
     

    Compute mass properties of a capsule

    ComputeCircleBounds ¶
    C · b2ComputeCircleBoundsSource · box2d.odin:96

    ComputeCircleBounds :: proc "c" (#by_ptr shape: Circle, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed circle

    ComputeCircleMass ¶
    C · b2ComputeCircleMassSource · box2d.odin:99

    ComputeCircleMass :: proc "c" (#by_ptr shape: Circle, density: f32) -> MassData ---
     

    Compute mass properties of a circle

    ComputeCosSin ¶
    C · b2ComputeCosSinSource · box2d.odin:102

    ComputeCosSin :: proc "c" (radians: f32) -> CosSin ---
     

    Compute the cosine and sine of an angle in radians. Implemented for cross-platform determinism.

    ComputeHull ¶

    @(require_results)
    ComputeHull :: proc "c" (points: [][2]f32) -> Hull {…}
     

    Compute the convex hull of a set of points. Returns an empty hull if it fails. Some failure cases:

    • all points very close together
    • all points on a line
    • less than 3 points
    • more than B2_MAX_POLYGON_VERTICES points

    This welds close points and removes collinear points. @warning Do not modify a hull once it has been computed

    ComputePolygonBounds ¶
    C · b2ComputePolygonBoundsSource · box2d.odin:105

    ComputePolygonBounds :: proc "c" (#by_ptr shape: Polygon, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed polygon

    ComputePolygonMass ¶
    C · b2ComputePolygonMassSource · box2d.odin:108

    ComputePolygonMass :: proc "c" (#by_ptr shape: Polygon, density: f32) -> MassData ---
     

    Compute mass properties of a polygon

    ComputeRotationBetweenUnitVectors ¶
    C · b2ComputeRotationBetweenUnitVectorsSource · box2d.odin:111

    ComputeRotationBetweenUnitVectors :: proc "c" (v1, v2: [2]f32) -> Rot ---
     

    Compute the rotation between two unit vectors

    ComputeSegmentBounds ¶
    C · b2ComputeSegmentBoundsSource · box2d.odin:114

    ComputeSegmentBounds :: proc "c" (#by_ptr shape: Segment, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed line segment

    ComputeSegmentDistance ¶
    C · b2ComputeSegmentDistanceSource · box2d.odin:117

    ComputeSegmentDistance :: proc "c" (
    	p1: [2]f32, 
    	q1: [2]f32, 
    	p2: [2]f32, 
    	q2: [2]f32, 
    ) -> SegmentDistanceResult ---
     

    Compute the distance between two line segments, clamping at the end points if needed.

    ComputeShapeDistance ¶

    @(require_results)
    ComputeShapeDistance :: proc "c" (
    	#by_ptr input: DistanceInput, 
    	cache:     ^SimplexCache, 
    	simplexes: []Simplex, 
    ) -> DistanceOutput {…}
     

    Compute the closest points between two shapes represented as point clouds. b2SimplexCache cache is input/output. On the first call set b2SimplexCache.count to zero. The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these.

    ComputeTimeOfImpact ¶
    C · b2ComputeTimeOfImpactSource · box2d.odin:122

    ComputeTimeOfImpact :: proc "c" (#by_ptr input: TOIInput) -> TOIOutput ---
     

    Compute the upper bound on time before two shapes penetrate. Time is represented as a fraction between [0,maxFraction]. This uses a swept separating axis and may miss some intermediate, non-tunneling collisions. If you change the time interval, you should call this function again.

    Contact_GetData ¶
    C · b2Contact_GetDataSource · box2d.odin:796

    Contact_GetData :: proc "c" (contactId: ContactId) -> ContactData ---
     

    Get the data for a contact. The manifold may have no points if the contact is not touching.

    Contact_IsValid ¶
    C · b2Contact_IsValidSource · box2d.odin:799

    Contact_IsValid :: proc "c" (id: ContactId) -> bool ---
     

    Contact identifier validation. Provides validation for up to 2^32 allocations.

    CreateBody ¶
    C · b2CreateBodySource · box2d.odin:131

    CreateBody :: proc "c" (worldId: WorldId, #by_ptr def: BodyDef) -> BodyId ---
     

    Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition on the stack and pass it as a pointer. @code{.c} b2BodyDef bodyDef = b2DefaultBodyDef(); b2BodyId myBodyId = b2CreateBody(myWorldId, &bodyDef); @endcode @warning This function is locked during callbacks.

    External examples raylib/box2d

    CreateCapsuleShape ¶
    C · b2CreateCapsuleShapeSource · box2d.odin:137

    CreateCapsuleShape :: proc "c" (
    	bodyId:  BodyId, 
    	#by_ptr def: ShapeDef, 
    	#by_ptr capsule: Capsule, 
    ) -> ShapeId ---
     

    Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape, this will be b2_nullShapeId if the length is too small.

    CreateChain ¶
    C · b2CreateChainSource · box2d.odin:141

    CreateChain :: proc "c" (bodyId: BodyId, #by_ptr def: ChainDef) -> ChainId ---
     

    Create a chain shape @see b2ChainDef for details

    CreateChainSegmentShape ¶
    C · b2CreateChainSegmentShapeSource · box2d.odin:148

    CreateChainSegmentShape :: proc "c" (
    	bodyId:       BodyId, 
    	#by_ptr def:  ShapeDef, 
    	#by_ptr chainSegment: ChainSegment, 
    ) -> ShapeId ---
     

    Create a chain segment shape and attach it to a body. The shape definition and geometry are fully cloned. The segment is not owned by any chain shape (b2Shape_GetParentChain returns b2_nullChainId). Contacts are not created until the next time step. The chainId on the segment is ignored. This uses more memory than using a chain shape, so I don't recommend using this. @return the shape id, or b2_nullShapeId if the segment is too short.

    CreateCircleShape ¶
    C · b2CreateCircleShapeSource · box2d.odin:153

    CreateCircleShape :: proc "c" (
    	bodyId: BodyId, 
    	#by_ptr def: ShapeDef, 
    	#by_ptr circle: Circle, 
    ) -> ShapeId ---
     

    Create a circle shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

    CreateDistanceJoint ¶
    C · b2CreateDistanceJointSource · box2d.odin:157

    CreateDistanceJoint :: proc "c" (worldId: WorldId, #by_ptr def: DistanceJointDef) -> JointId ---
     

    Create a distance joint @see b2DistanceJointDef for details

    CreateDynamicTree ¶
    C · b2CreateDynamicTreeSource · box2d.odin:160

    CreateDynamicTree :: proc "c" (proxyCapacity: i32) -> ^DynamicTree ---
     

    Constructing the tree initializes the node pool.

    CreateFilterJoint ¶
    C · b2CreateFilterJointSource · box2d.odin:164

    CreateFilterJoint :: proc "c" (worldId: WorldId, #by_ptr def: FilterJointDef) -> JointId ---
     

    Create a filter joint. @see b2FilterJointDef for details

    CreateMotorJoint ¶
    C · b2CreateMotorJointSource · box2d.odin:168

    CreateMotorJoint :: proc "c" (worldId: WorldId, #by_ptr def: MotorJointDef) -> JointId ---
     

    Create a motor joint @see b2MotorJointDef for details

    CreateMoverJoint ¶
    C · b2CreateMoverJointSource · box2d.odin:172

    CreateMoverJoint :: proc "c" (worldId: WorldId, #by_ptr def: MoverJointDef) -> JointId ---
     

    Create a mover joint @see b2MoverJointDef for details

    CreatePogoJoint ¶
    C · b2CreatePogoJointSource · box2d.odin:176

    CreatePogoJoint :: proc "c" (worldId: WorldId, #by_ptr def: PogoJointDef) -> JointId ---
     

    Create a pogo joint @see b2PogoJointDef for details

    CreatePolygonShape ¶
    C · b2CreatePolygonShapeSource · box2d.odin:181

    CreatePolygonShape :: proc "c" (
    	bodyId:  BodyId, 
    	#by_ptr def: ShapeDef, 
    	#by_ptr polygon: Polygon, 
    ) -> ShapeId ---
     

    Create a polygon shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

    External examples raylib/box2d

    CreatePrismaticJoint ¶
    C · b2CreatePrismaticJointSource · box2d.odin:185

    CreatePrismaticJoint :: proc "c" (worldId: WorldId, #by_ptr def: PrismaticJointDef) -> JointId ---
     

    Create a prismatic (slider) joint. @see b2PrismaticJointDef for details

    CreateRecording ¶
    C · b2CreateRecordingSource · box2d.odin:190

    CreateRecording :: proc "c" (byteCapacity: i32) -> ^Recording ---
     

    Create a recording buffer. The buffer grows on demand. @p byteCapacity pre-sizes it to avoid reallocations during a known-length session. Pass 0 for a small default. @return A recording handle, freed with b2DestroyRecording

    CreateRecordingFromFile ¶
    C · b2CreateRecordingFromFileSource · box2d.odin:195

    CreateRecordingFromFile :: proc "c" (path: cstring) -> ^Recording ---
     

    Load a recording from a file into a new recording buffer. Convenience wrapper over your own file I/O. Destroy the result with b2DestroyRecording. @return NULL if the file is missing or unreadable

    CreateReplay ¶
    C · b2CreateReplaySource · box2d.odin:203

    CreateReplay :: proc "c" (data: rawptr, size: i32, workerCount: i32) -> ^Replay ---
     

    Open a recording for incremental playback and replay up to the first step. The player copies the bytes, so you may free or destroy the source buffer immediately after this call. @param data Recorded bytes @param size Number of recorded bytes @param workerCount Worker count for the replay world. 0 uses the serial single-worker fallback. @return A player handle, or NULL if the recording is malformed

    CreateRevoluteJoint ¶
    C · b2CreateRevoluteJointSource · box2d.odin:207

    CreateRevoluteJoint :: proc "c" (worldId: WorldId, #by_ptr def: RevoluteJointDef) -> JointId ---
     

    Create a revolute joint @see b2RevoluteJointDef for details

    CreateSegmentShape ¶
    C · b2CreateSegmentShapeSource · box2d.odin:212

    CreateSegmentShape :: proc "c" (
    	bodyId:  BodyId, 
    	#by_ptr def: ShapeDef, 
    	#by_ptr segment: Segment, 
    ) -> ShapeId ---
     

    Create a line segment shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id or b2_nullShapeId if the segment is too short.

    CreateTreeProxy ¶
    C · b2CreateTreeProxySource · box2d.odin:215

    CreateTreeProxy :: proc "c" (
    	tree:         ^DynamicTree, 
    	aabb:         AABB, 
    	categoryBits: u64, 
    	userData:     u64, 
    ) -> i32 ---
     

    Create a proxy. Provide an AABB and a userData value.

    CreateWeldJoint ¶
    C · b2CreateWeldJointSource · box2d.odin:219

    CreateWeldJoint :: proc "c" (worldId: WorldId, #by_ptr def: WeldJointDef) -> JointId ---
     

    Create a weld joint @see b2WeldJointDef for details

    CreateWheelJoint ¶
    C · b2CreateWheelJointSource · box2d.odin:223

    CreateWheelJoint :: proc "c" (worldId: WorldId, #by_ptr def: WheelJointDef) -> JointId ---
     

    Create a wheel joint @see b2WheelJointDef for details

    CreateWorld ¶
    C · b2CreateWorldSource · box2d.odin:229

    CreateWorld :: proc "c" (#by_ptr def: WorldDef) -> WorldId ---
     

    Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You may create up to B2_MAX_WORLDS worlds. Each world is completely independent and may be simulated in parallel. @return the world id.

    External examples raylib/box2d

    CreateWorldFromSnapshot ¶
    C · b2CreateWorldFromSnapshotSource · box2d.odin:237

    CreateWorldFromSnapshot :: proc "c" (image: [^]u8, size: i32, workerCount: i32) -> WorldId ---
     

    Create a new world from a snapshot image. This is mainly useful for replay. Callbacks are reset to default. @param image A snapshot image produced by b2World_GetSnapshot @param size Size of image in bytes @param workerCount Worker count for the new world. 0 uses the serial single-worker fallback. @return The new world id, or b2_nullWorldId on failure.

    Cross ¶

    @(require_results)
    Cross :: proc "c" (a, b: [2]f32) -> f32 {…}
     

    Vector cross product. In 2D this yields a scalar.

    CrossSV ¶

    @(require_results)
    CrossSV :: proc "c" (s: f32, v: [2]f32) -> [2]f32 {…}
     

    Perform the cross product on a scalar and a vector. In 2D this produces a vector.

    CrossVS ¶

    @(require_results)
    CrossVS :: proc "c" (v: [2]f32, s: f32) -> [2]f32 {…}
     

    Perform the cross product on a vector and a scalar. In 2D this produces a vector.

    DefaultBodyDef ¶
    C · b2DefaultBodyDefSource · box2d.odin:240

    DefaultBodyDef :: proc "c" () -> BodyDef ---
     

    Use this to initialize your body definition

    External examples raylib/box2d

    DefaultChainDef ¶
    C · b2DefaultChainDefSource · box2d.odin:243

    DefaultChainDef :: proc "c" () -> ChainDef ---
     

    Use this to initialize your chain definition

    DefaultDebugDraw ¶
    C · b2DefaultDebugDrawSource · box2d.odin:247

    DefaultDebugDraw :: proc "c" () -> DebugDraw ---
     

    Use this to initialize your drawing interface. This allows you to implement a subset of the drawing functions.

    DefaultDistanceJointDef ¶
    C · b2DefaultDistanceJointDefSource · box2d.odin:250

    DefaultDistanceJointDef :: proc "c" () -> DistanceJointDef ---
     

    Use this to initialize your joint definition

    DefaultExplosionDef ¶
    C · b2DefaultExplosionDefSource · box2d.odin:253

    DefaultExplosionDef :: proc "c" () -> ExplosionDef ---
     

    Use this to initialize your explosion definition

    DefaultFilter ¶
    C · b2DefaultFilterSource · box2d.odin:256

    DefaultFilter :: proc "c" () -> Filter ---
     

    Use this to initialize your filter

    DefaultFilterJointDef ¶
    C · b2DefaultFilterJointDefSource · box2d.odin:259

    DefaultFilterJointDef :: proc "c" () -> FilterJointDef ---
     

    Use this to initialize your joint definition

    DefaultMotorJointDef ¶
    C · b2DefaultMotorJointDefSource · box2d.odin:262

    DefaultMotorJointDef :: proc "c" () -> MotorJointDef ---
     

    Use this to initialize your joint definition

    DefaultMoverJointDef ¶
    C · b2DefaultMoverJointDefSource · box2d.odin:265

    DefaultMoverJointDef :: proc "c" () -> MoverJointDef ---
     

    Use this to initialize your joint definition

    DefaultPogoJointDef ¶
    C · b2DefaultPogoJointDefSource · box2d.odin:268

    DefaultPogoJointDef :: proc "c" () -> PogoJointDef ---
     

    Use this to initialize your joint definition

    DefaultPrismaticJointDef ¶
    C · b2DefaultPrismaticJointDefSource · box2d.odin:271

    DefaultPrismaticJointDef :: proc "c" () -> PrismaticJointDef ---
     

    Use this to initialize your joint definition

    DefaultQueryFilter ¶
    C · b2DefaultQueryFilterSource · box2d.odin:274

    DefaultQueryFilter :: proc "c" () -> QueryFilter ---
     

    Use this to initialize your query filter

    DefaultRevoluteJointDef ¶
    C · b2DefaultRevoluteJointDefSource · box2d.odin:277

    DefaultRevoluteJointDef :: proc "c" () -> RevoluteJointDef ---
     

    Use this to initialize your joint definition.

    DefaultShapeDef ¶
    C · b2DefaultShapeDefSource · box2d.odin:280

    DefaultShapeDef :: proc "c" () -> ShapeDef ---
     

    Use this to initialize your shape definition

    External examples raylib/box2d

    DefaultSurfaceMaterial ¶
    C · b2DefaultSurfaceMaterialSource · box2d.odin:283

    DefaultSurfaceMaterial :: proc "c" () -> SurfaceMaterial ---
     

    Use this to initialize your surface material

    DefaultWeldJointDef ¶
    C · b2DefaultWeldJointDefSource · box2d.odin:286

    DefaultWeldJointDef :: proc "c" () -> WeldJointDef ---
     

    Use this to initialize your joint definition

    DefaultWheelJointDef ¶
    C · b2DefaultWheelJointDefSource · box2d.odin:289

    DefaultWheelJointDef :: proc "c" () -> WheelJointDef ---
     

    Use this to initialize your joint definition

    DefaultWorldDef ¶
    C · b2DefaultWorldDefSource · box2d.odin:292

    DefaultWorldDef :: proc "c" () -> WorldDef ---
     

    Use this to initialize your world definition

    External examples raylib/box2d

    DestroyBody ¶
    C · b2DestroyBodySource · box2d.odin:296

    DestroyBody :: proc "c" (bodyId: BodyId) ---
     

    Destroy a rigid body given an id. This destroys all shapes and joints attached to the body. Do not keep references to the associated shapes and joints.

    DestroyChain ¶
    C · b2DestroyChainSource · box2d.odin:299

    DestroyChain :: proc "c" (chainId: ChainId) ---
     

    Destroy a chain shape

    DestroyDynamicTree ¶
    C · b2DestroyDynamicTreeSource · box2d.odin:302

    DestroyDynamicTree :: proc "c" (tree: ^DynamicTree) ---
     

    Destroy the tree, freeing the node pool.

    DestroyJoint ¶
    C · b2DestroyJointSource · box2d.odin:305

    DestroyJoint :: proc "c" (jointId: JointId) ---
     

    Destroy a joint.

    DestroyRecording ¶
    C · b2DestroyRecordingSource · box2d.odin:308

    DestroyRecording :: proc "c" (recording: ^Recording) ---
     

    Destroy a recording buffer and free its memory.

    DestroyReplay ¶
    C · b2DestroyReplaySource · box2d.odin:311

    DestroyReplay :: proc "c" (player: ^Replay) ---
     

    Close a player and free its replay world and file buffer.

    DestroyShape ¶
    C · b2DestroyShapeSource · box2d.odin:316

    DestroyShape :: proc "c" (shapeId: ShapeId, updateBodyMass: bool) ---
     

    Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a body are destroyed at once. @see b2Body_UpdateMassFromShapes

    DestroyTreeProxy ¶
    C · b2DestroyTreeProxySource · box2d.odin:319

    DestroyTreeProxy :: proc "c" (tree: ^DynamicTree, proxyId: i32) ---
     

    Destroy a proxy. This asserts if the id is invalid.

    DestroyWorld ¶
    C · b2DestroyWorldSource · box2d.odin:322

    DestroyWorld :: proc "c" (worldId: WorldId) ---
     

    Destroy a world

    Distance ¶

    @(require_results)
    Distance :: proc "c" (a, b: [2]f32) -> f32 {…}
     

    Get the distance between two points

    DistanceJoint_EnableLimit ¶
    C · b2DistanceJoint_EnableLimitSource · box2d.odin:807

    DistanceJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---
     

    Enable joint limit. The limit only works if the joint spring is enabled. Otherwise the joint is rigid and the limit has no effect.

    DistanceJoint_EnableMotor ¶
    C · b2DistanceJoint_EnableMotorSource · box2d.odin:810

    DistanceJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---
     

    Enable/disable the distance joint motor

    DistanceJoint_EnableSpring ¶
    C · b2DistanceJoint_EnableSpringSource · box2d.odin:813

    DistanceJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---
     

    Enable/disable the distance joint spring. When disabled the distance joint is rigid.

    DistanceJoint_GetCurrentLength ¶
    C · b2DistanceJoint_GetCurrentLengthSource · box2d.odin:816

    DistanceJoint_GetCurrentLength :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current length of a distance joint

    DistanceJoint_GetCurrentMotorForce ¶
    C · b2DistanceJoint_GetCurrentMotorForceSource · box2d.odin:819

    DistanceJoint_GetCurrentMotorForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the distance joint current motor force, usually in newtons

    DistanceJoint_GetLowerLimit ¶
    C · b2DistanceJoint_GetLowerLimitSource · box2d.odin:822

    DistanceJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the distance joint minimum length

    DistanceJoint_GetMaxMotorForce ¶
    C · b2DistanceJoint_GetMaxMotorForceSource · box2d.odin:825

    DistanceJoint_GetMaxMotorForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the distance joint maximum motor force, usually in newtons

    DistanceJoint_GetRestLength ¶
    C · b2DistanceJoint_GetRestLengthSource · box2d.odin:828

    DistanceJoint_GetRestLength :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the rest length of a distance joint

    DistanceJoint_GetSpringDampingRatio ¶
    C · b2DistanceJoint_GetSpringDampingRatioSource · box2d.odin:831

    DistanceJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring damping ratio

    DistanceJoint_GetSpringForce ¶
    C · b2DistanceJoint_GetSpringForceSource · box2d.odin:834

    DistanceJoint_GetSpringForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current spring force.

    DistanceJoint_GetSpringForceRange ¶
    C · b2DistanceJoint_GetSpringForceRangeSource · box2d.odin:837

    DistanceJoint_GetSpringForceRange :: proc "c" (
    	jointId:    JointId, 
    	lowerForce: ^f32, 
    	upperForce: ^f32, 
    ) ---
     

    Get the force range for the spring.

    DistanceJoint_GetSpringHertz ¶
    C · b2DistanceJoint_GetSpringHertzSource · box2d.odin:840

    DistanceJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring Hertz

    DistanceJoint_GetTargetMotorSpeed ¶
    C · b2DistanceJoint_GetTargetMotorSpeedSource · box2d.odin:843

    DistanceJoint_GetTargetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the distance joint motor speed, usually in meters per second

    DistanceJoint_GetUpperLimit ¶
    C · b2DistanceJoint_GetUpperLimitSource · box2d.odin:846

    DistanceJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the distance joint maximum length

    DistanceJoint_IsLimitEnabled ¶
    C · b2DistanceJoint_IsLimitEnabledSource · box2d.odin:849

    DistanceJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the distance joint limit enabled?

    DistanceJoint_IsMotorEnabled ¶
    C · b2DistanceJoint_IsMotorEnabledSource · box2d.odin:852

    DistanceJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the distance joint motor enabled?

    DistanceJoint_IsSpringEnabled ¶
    C · b2DistanceJoint_IsSpringEnabledSource · box2d.odin:855

    DistanceJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the distance joint spring enabled?

    DistanceJoint_SetLimits ¶
    C · b2DistanceJoint_SetLimitsSource · box2d.odin:858

    DistanceJoint_SetLimits :: proc "c" (jointId: JointId, minLength: f32, maxLength: f32) ---
     

    Set the minimum and maximum length parameters of a distance joint

    DistanceJoint_SetMaxMotorForce ¶
    C · b2DistanceJoint_SetMaxMotorForceSource · box2d.odin:861

    DistanceJoint_SetMaxMotorForce :: proc "c" (jointId: JointId, force: f32) ---
     

    Set the distance joint maximum motor force, usually in newtons

    DistanceJoint_SetRestLength ¶
    C · b2DistanceJoint_SetRestLengthSource · box2d.odin:866

    DistanceJoint_SetRestLength :: proc "c" (jointId: JointId, length: f32) ---
     

    Set the rest length of a distance joint @param jointId The id for a distance joint @param length The new distance joint length

    DistanceJoint_SetSpringDampingRatio ¶
    C · b2DistanceJoint_SetSpringDampingRatioSource · box2d.odin:869

    DistanceJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the spring damping ratio, non-dimensional

    DistanceJoint_SetSpringForceRange ¶
    C · b2DistanceJoint_SetSpringForceRangeSource · box2d.odin:872

    DistanceJoint_SetSpringForceRange :: proc "c" (
    	jointId:    JointId, 
    	lowerForce: f32, 
    	upperForce: f32, 
    ) ---
     

    Set the force range for the spring.

    DistanceJoint_SetSpringHertz ¶
    C · b2DistanceJoint_SetSpringHertzSource · box2d.odin:875

    DistanceJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the spring stiffness in Hertz

    DistanceJoint_SetTargetMotorSpeed ¶
    C · b2DistanceJoint_SetTargetMotorSpeedSource · box2d.odin:878

    DistanceJoint_SetTargetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---
     

    Set the distance joint motor speed, usually in meters per second

    DistanceSquared ¶

    @(require_results)
    DistanceSquared :: proc "c" (a, b: [2]f32) -> f32 {…}
     

    Get the distance squared between points

    Dot ¶

    @(require_results)
    Dot :: proc "c" (a, b: [2]f32) -> f32 {…}
     

    Vector dot product

    DynamicTree_CastBox ¶
    C · b2DynamicTree_CastBoxSource · box2d.odin:893

    DynamicTree_CastBox :: proc "c" (
    	tree:        ^DynamicTree, 
    	#by_ptr input: BoxCastInput, 
    	maskBits:    u64, 
    	callback:    TreeBoxCastCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Cast a swept AABB through the tree. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. @param tree the dynamic tree to cast through @param input the AABB cast input. The box sweeps from its origin to origin + maxFraction * translation. @param maskBits filter bits: bool accept = (maskBits & proxy->categoryBits) != 0; @param callback a callback that is called for each proxy the swept box may hit @param context user context that is passed to the callback @return performance data

    DynamicTree_CastRay ¶
    C · b2DynamicTree_CastRaySource · box2d.odin:907

    DynamicTree_CastRay :: proc "c" (
    	tree:        ^DynamicTree, 
    	#by_ptr input: RayCastInput, 
    	maskBits:    u64, 
    	callback:    TreeRayCastCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Ray cast against the proxies in the tree. This relies on the callback to perform an exact ray cast in the case where the proxy contains a shape. The callback also performs any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. Bit-wise filtering using mask bits can improve performance in some scenarios. However, this filtering may be approximate, so the user should still apply filtering to results. @param tree the dynamic tree to ray cast @param input the ray cast input data. @param maskBits mask bits used to filter proxies. @param callback a callback that is called for each proxy that is hit by the ray @param context user context that is passed to the callback @return performance data

    DynamicTree_GetAreaRatio ¶
    C · b2DynamicTree_GetAreaRatioSource · box2d.odin:910

    DynamicTree_GetAreaRatio :: proc "c" (tree: ^DynamicTree) -> f32 ---
     

    Get the ratio of the sum of the internal node areas to the root area.

    DynamicTree_GetByteCount ¶
    C · b2DynamicTree_GetByteCountSource · box2d.odin:913

    DynamicTree_GetByteCount :: proc "c" (tree: ^DynamicTree) -> uint ---
     

    Get the number of bytes used by this tree

    DynamicTree_GetCategoryBits ¶
    C · b2DynamicTree_GetCategoryBitsSource · box2d.odin:916

    DynamicTree_GetCategoryBits :: proc "c" (tree: ^DynamicTree, proxyId: i32) -> u64 ---
     

    Get the category bits on a proxy.

    DynamicTree_GetHeight ¶
    C · b2DynamicTree_GetHeightSource · box2d.odin:919

    DynamicTree_GetHeight :: proc "c" (tree: ^DynamicTree) -> i32 ---
     

    Get the height of the binary tree.

    DynamicTree_GetProxyBounds ¶
    C · b2DynamicTree_GetProxyBoundsSource · box2d.odin:922

    DynamicTree_GetProxyBounds :: proc "c" (tree: ^DynamicTree, proxyId: i32) -> AABB ---
     

    Get the AABB of a proxy

    DynamicTree_GetProxyCount ¶
    C · b2DynamicTree_GetProxyCountSource · box2d.odin:925

    DynamicTree_GetProxyCount :: proc "c" (tree: ^DynamicTree) -> i32 ---
     

    Get the number of proxies created

    DynamicTree_GetRootBounds ¶
    C · b2DynamicTree_GetRootBoundsSource · box2d.odin:928

    DynamicTree_GetRootBounds :: proc "c" (tree: ^DynamicTree) -> AABB ---
     

    Get the bounding box that contains the entire tree

    DynamicTree_GetUserData ¶
    C · b2DynamicTree_GetUserDataSource · box2d.odin:931

    DynamicTree_GetUserData :: proc "c" (tree: ^DynamicTree, proxyId: i32) -> u64 ---
     

    Get proxy user data

    DynamicTree_MoveProxy ¶
    C · b2DynamicTree_MoveProxySource · box2d.odin:934

    DynamicTree_MoveProxy :: proc "c" (tree: ^DynamicTree, proxyId: i32, aabb: AABB) ---
     

    Move a proxy to a new AABB by removing and reinserting into the tree.

    DynamicTree_OverlapAABB ¶
    C · b2DynamicTree_OverlapAABBSource · box2d.odin:939

    DynamicTree_OverlapAABB :: proc "c" (
    	tree:        ^DynamicTree, 
    	aabb:        AABB, 
    	maskBits:    u64, 
    	callback:    TreeQueryCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Query an AABB for overlapping proxies. The callback is called for each proxy that overlaps the supplied AABB. @return performance data

    DynamicTree_OverlapAABBAll ¶
    C · b2DynamicTree_OverlapAABBAllSource · box2d.odin:944

    DynamicTree_OverlapAABBAll :: proc "c" (
    	tree:        ^DynamicTree, 
    	aabb:        AABB, 
    	callback:    TreeQueryCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Query an AABB for overlapping proxies. The callback is called for each proxy that overlaps the supplied AABB. No filtering is performed. @return performance data

    DynamicTree_SetCategoryBits ¶
    C · b2DynamicTree_SetCategoryBitsSource · box2d.odin:947

    DynamicTree_SetCategoryBits :: proc "c" (tree: ^DynamicTree, proxyId: i32, categoryBits: u64) ---
     

    Modify the category bits on a proxy.

    DynamicTree_Validate ¶
    C · b2DynamicTree_ValidateSource · box2d.odin:950

    DynamicTree_Validate :: proc "c" (tree: ^DynamicTree) ---
     

    Validate the tree.

    GetByteCount ¶
    C · b2GetByteCountSource · box2d.odin:325

    GetByteCount :: proc "c" () -> uint ---
     

    @return the total bytes allocated by Box2D

    GetGraphColor ¶
    C · b2GetGraphColorSource · box2d.odin:329

    GetGraphColor :: proc "c" (index: i32) -> HexColor ---
     

    Get the visualization color assigned to a constraint graph color slot. The last index (B2_GRAPH_COLOR_COUNT - 1) is the overflow color.

    GetInverse22 ¶

    @(require_results)
    GetInverse22 :: proc "c" (A: matrix[2, 2]f32) -> matrix[2, 2]f32 {…}
     

    Get the inverse of a 2-by-2 matrix

    GetLengthAndNormalize ¶

    @(require_results)
    GetLengthAndNormalize :: proc "c" (a: [2]f32) -> (length: f32, vn: [2]f32) {…}
     

    Convert a vector into a unit vector if possible, otherwise returns the zero vector. Also returns the length.

    GetLengthUnitsPerMeter ¶
    C · b2GetLengthUnitsPerMeterSource · box2d.odin:332

    GetLengthUnitsPerMeter :: proc "c" () -> f32 ---
     

    Get the current length units per meter.

    GetMilliseconds ¶
    C · b2GetMillisecondsSource · box2d.odin:335

    GetMilliseconds :: proc "c" (ticks: u64) -> f32 ---
     

    Get the milliseconds passed from an initial tick value.

    GetMillisecondsAndReset ¶
    C · b2GetMillisecondsAndResetSource · box2d.odin:339

    GetMillisecondsAndReset :: proc "c" (ticks: ^u64) -> f32 ---
     

    Get the milliseconds passed from an initial tick value. Resets the passed in value to the current tick value.

    GetSweepTransform ¶
    C · b2GetSweepTransformSource · box2d.odin:342

    GetSweepTransform :: proc "c" (#by_ptr sweep: Sweep, time: f32) -> Transform ---
     

    Evaluate the transform sweep at a specific time.

    GetTicks ¶

    GetTicks :: proc "c" () -> u64 ---
     

    Get the absolute number of system ticks. The value is platform specific.

    GetVersion ¶
    C · b2GetVersionSource · box2d.odin:348

    GetVersion :: proc "c" () -> Version ---
     

    Get the current version of Box2D

    HUGE ¶

    @(require_results)
    HUGE :: proc "c" () -> f32 {…}
     

    Used to detect bad values. Positions greater than about 16km will have precision problems in single precision, so 100km as a limit should be fine in all cases.

    Hash ¶

    Hash :: proc "c" (hash: u32, data: [^]u8, count: i32) -> u32 ---
     

    Simple djb2 hash function for determinism testing

    ID_EQUALS ¶

    ID_EQUALS :: proc "c" (id1, id2: $T) -> bool {…}
     

    Compare two ids for equality. Doesn't work for WorldId. Don't mix types.

    IS_NON_NULL ¶

    IS_NON_NULL :: proc "c" (id: $T) -> bool {…}
     

    Macro to determine if any id is non-null.

    IS_NULL ¶

    IS_NULL :: proc "c" (id: $T) -> bool {…}
     

    Macro to determine if any id is null.

    IntegrateRotation ¶

    @(require_results)
    IntegrateRotation :: proc "c" (q1: Rot, deltaAngle: f32) -> Rot {…}
     

    Integration rotation from angular velocity

    @param q1 initial rotation
    @param deltaAngle the angular displacement in radians
    

    InvMulRot ¶

    @(require_results)
    InvMulRot :: proc "c" (a, b: Rot) -> (r: Rot) {…}
     

    Transpose multiply two rotations: inv(a) * b This rotates a vector local in frame b into a vector local in frame a

    InvMulTransforms ¶

    @(require_results)
    InvMulTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}
     

    Creates a transform that converts a local point in frame B to a local point in frame A. v2 = A.q' * (B.q * v1 + B.p - A.p) = A.q' * B.q * v1 + A.q' * (B.p - A.p)

    InvMulWorldTransforms ¶

    @(require_results)
    InvMulWorldTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}
     

    Relative transform of frame B in frame A.

    InvRotateVector ¶

    @(require_results)
    InvRotateVector :: proc "c" (q: Rot, v: [2]f32) -> [2]f32 {…}
     

    Inverse rotate a vector

    InvTransformPoint ¶

    @(require_results)
    InvTransformPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}
     

    Inverse transform a point (e.g. world space to local space)

    InvTransformWorldPoint ¶

    @(require_results)
    InvTransformWorldPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}
     

    Transform a world position to a local point. One double subtraction, then float.

    InvertRot ¶

    @(require_results)
    InvertRot :: proc "c" (a: Rot) -> Rot {…}
     

    Get the inverse of a rotation

    IsAVX2Available ¶
    C · b2IsAVX2AvailableSource · box2d.odin:354

    IsAVX2Available :: proc "c" () -> bool ---
     

    @return true if the current CPU has the AVX2 instruction set.

    IsDoublePrecision ¶
    C · b2IsDoublePrecisionSource · box2d.odin:357

    IsDoublePrecision :: proc "c" () -> bool ---
     

    @return true if the library was built with BOX2D_DOUBLE_PRECISION (large world mode)

    IsNormalized ¶

    @(require_results)
    IsNormalized :: proc "c" (v: [2]f32) -> bool {…}
     

    Determines if the provided vector is normalized (norm(a) == 1).

    IsNormalizedRot ¶

    @(require_results)
    IsNormalizedRot :: proc "c" (q: Rot) -> bool {…}
     

    Is this rotation normalized?

    IsValidAABB ¶
    C · b2IsValidAABBSource · box2d.odin:361

    IsValidAABB :: proc "c" (aabb: AABB) -> bool ---
     

    Is this a valid bounding box? Not NaN or infinity. Upper bound greater than or equal to lower bound.

    IsValidFloat ¶
    C · b2IsValidFloatSource · box2d.odin:364

    IsValidFloat :: proc "c" (a: f32) -> bool ---
     

    Is this a valid number? Not NaN or infinity.

    IsValidPlane ¶
    C · b2IsValidPlaneSource · box2d.odin:367

    IsValidPlane :: proc "c" (a: Plane) -> bool ---
     

    Is this a valid plane? Normal is a unit vector. Not NaN or infinity.

    IsValidPos ¶
    C · b2IsValidPosSource · box2d.odin:370

    IsValidPos :: proc "c" (p: [2]f32) -> bool ---
     

    Is this a valid world position? Not NaN or infinity.

    IsValidRay ¶
    C · b2IsValidRaySource · box2d.odin:373

    IsValidRay :: proc "c" (#by_ptr input: RayCastInput) -> bool ---
     

    Validate ray cast input data (NaN, etc)

    IsValidRot ¶
    C · b2IsValidRotSource · box2d.odin:376

    IsValidRot :: proc "c" (q: Rot) -> bool ---
     

    Is this a valid rotation? Not NaN or infinity. Is normalized.

    IsValidTransform ¶
    C · b2IsValidTransformSource · box2d.odin:379

    IsValidTransform :: proc "c" (t: Transform) -> bool ---
     

    Is this a valid transform? Not NaN or infinity. Rotation is normalized.

    IsValidVec2 ¶
    C · b2IsValidVec2Source · box2d.odin:382

    IsValidVec2 :: proc "c" (v: [2]f32) -> bool ---
     

    Is this a valid vector? Not NaN or infinity.

    IsValidWorldTransform ¶
    C · b2IsValidWorldTransformSource · box2d.odin:385

    IsValidWorldTransform :: proc "c" (t: Transform) -> bool ---
     

    Is this a valid world transform? Not NaN or infinity. Rotation is normalized.

    Joint_GetAngularSeparation ¶
    C · b2Joint_GetAngularSeparationSource · box2d.odin:958

    Joint_GetAngularSeparation :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current angular separation error for this joint. Does not consider admissible movement. Radians.

    Joint_GetBodyA ¶
    C · b2Joint_GetBodyASource · box2d.odin:961

    Joint_GetBodyA :: proc "c" (jointId: JointId) -> BodyId ---
     

    Get body A id on a joint

    Joint_GetBodyB ¶
    C · b2Joint_GetBodyBSource · box2d.odin:964

    Joint_GetBodyB :: proc "c" (jointId: JointId) -> BodyId ---
     

    Get body B id on a joint

    Joint_GetCollideConnected ¶
    C · b2Joint_GetCollideConnectedSource · box2d.odin:967

    Joint_GetCollideConnected :: proc "c" (jointId: JointId) -> bool ---
     

    Is collision allowed between connected bodies?

    Joint_GetConstraintForce ¶
    C · b2Joint_GetConstraintForceSource · box2d.odin:970

    Joint_GetConstraintForce :: proc "c" (jointId: JointId) -> [2]f32 ---
     

    Get the current constraint force for this joint. Usually in Newtons.

    Joint_GetConstraintTorque ¶
    C · b2Joint_GetConstraintTorqueSource · box2d.odin:973

    Joint_GetConstraintTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current constraint torque for this joint. Usually in Newton * meters.

    Joint_GetConstraintTuning ¶
    C · b2Joint_GetConstraintTuningSource · box2d.odin:976

    Joint_GetConstraintTuning :: proc "c" (jointId: JointId, hertz: ^f32, dampingRatio: ^f32) ---
     

    Get the joint constraint tuning. Advanced feature.

    Joint_GetForceThreshold ¶
    C · b2Joint_GetForceThresholdSource · box2d.odin:979

    Joint_GetForceThreshold :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the force threshold for joint events (Newtons)

    Joint_GetLinearSeparation ¶
    C · b2Joint_GetLinearSeparationSource · box2d.odin:983

    Joint_GetLinearSeparation :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters.

    Joint_GetLocalFrameA ¶
    C · b2Joint_GetLocalFrameASource · box2d.odin:986

    Joint_GetLocalFrameA :: proc "c" (jointId: JointId) -> Transform ---
     

    Get the local frame on bodyA

    Joint_GetLocalFrameB ¶
    C · b2Joint_GetLocalFrameBSource · box2d.odin:989

    Joint_GetLocalFrameB :: proc "c" (jointId: JointId) -> Transform ---
     

    Get the local frame on bodyB

    Joint_GetTorqueThreshold ¶
    C · b2Joint_GetTorqueThresholdSource · box2d.odin:992

    Joint_GetTorqueThreshold :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the torque threshold for joint events (N-m)

    Joint_GetType ¶
    C · b2Joint_GetTypeSource · box2d.odin:995

    Joint_GetType :: proc "c" (jointId: JointId) -> JointType ---
     

    Get the joint type

    Joint_GetUserData ¶
    C · b2Joint_GetUserDataSource · box2d.odin:998

    Joint_GetUserData :: proc "c" (jointId: JointId) -> rawptr ---
     

    Get the user data on a joint

    Joint_GetWorld ¶
    C · b2Joint_GetWorldSource · box2d.odin:1001

    Joint_GetWorld :: proc "c" (jointId: JointId) -> WorldId ---
     

    Get the world that owns this joint

    Joint_IsValid ¶
    C · b2Joint_IsValidSource · box2d.odin:1004

    Joint_IsValid :: proc "c" (id: JointId) -> bool ---
     

    Joint identifier validation. Provides validation for up to 64K allocations.

    Joint_SetCollideConnected ¶
    C · b2Joint_SetCollideConnectedSource · box2d.odin:1007

    Joint_SetCollideConnected :: proc "c" (jointId: JointId, shouldCollide: bool) ---
     

    Toggle collision between connected bodies

    Joint_SetConstraintTuning ¶
    C · b2Joint_SetConstraintTuningSource · box2d.odin:1013

    Joint_SetConstraintTuning :: proc "c" (jointId: JointId, hertz: f32, dampingRatio: f32) ---
     

    Set the joint constraint tuning. Advanced feature. @param jointId the joint @param hertz the stiffness in Hertz (cycles per second) @param dampingRatio the non-dimensional damping ratio (one for critical damping)

    Joint_SetForceThreshold ¶
    C · b2Joint_SetForceThresholdSource · box2d.odin:1016

    Joint_SetForceThreshold :: proc "c" (jointId: JointId, threshold: f32) ---
     

    Set the force threshold for joint events (Newtons)

    Joint_SetLocalFrameA ¶
    C · b2Joint_SetLocalFrameASource · box2d.odin:1019

    Joint_SetLocalFrameA :: proc "c" (jointId: JointId, localFrame: Transform) ---
     

    Set the local frame on bodyA

    Joint_SetLocalFrameB ¶
    C · b2Joint_SetLocalFrameBSource · box2d.odin:1022

    Joint_SetLocalFrameB :: proc "c" (jointId: JointId, localFrame: Transform) ---
     

    Set the local frame on bodyB

    Joint_SetTorqueThreshold ¶
    C · b2Joint_SetTorqueThresholdSource · box2d.odin:1025

    Joint_SetTorqueThreshold :: proc "c" (jointId: JointId, threshold: f32) ---
     

    Set the torque threshold for joint events (N-m)

    Joint_SetUserData ¶
    C · b2Joint_SetUserDataSource · box2d.odin:1028

    Joint_SetUserData :: proc "c" (jointId: JointId, userData: rawptr) ---
     

    Set the user data on a joint

    Joint_WakeBodies ¶
    C · b2Joint_WakeBodiesSource · box2d.odin:1031

    Joint_WakeBodies :: proc "c" (jointId: JointId) ---
     

    Wake the bodies connected to this joint

    LINEAR_SLOP ¶

    @(require_results)
    LINEAR_SLOP :: proc "c" () -> f32 {…}
     

    A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant. In meters. Normally this is 0.5cm. @warning modifying this can have a significant impact on stability

    LeftPerp ¶

    @(require_results)
    LeftPerp :: proc "c" (v: [2]f32) -> [2]f32 {…}
     

    Get a left pointing perpendicular vector. Equivalent to b2CrossSV(1, v)

    Length ¶

    @(require_results)
    Length :: proc "c" (v: [2]f32) -> f32 {…}
     

    Get the length of this vector (the norm)

    LengthSquared ¶

    @(require_results)
    LengthSquared :: proc "c" (v: [2]f32) -> f32 {…}
     

    Get the length squared of this vector

    Lerp ¶

    @(require_results)
    Lerp :: proc "c" (a, b: [2]f32, t: f32) -> [2]f32 {…}
     

    Vector linear interpolation https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/

    LerpPos ¶

    @(require_results)
    LerpPos :: proc "c" (a, b: [2]f32, t: f32) -> [2]f32 {…}
     

    World position interpolation for sweeps and sampling.

    LoadBodyId ¶

    LoadBodyId :: proc "c" (x: u64) -> BodyId {…}
     

    Load a u64 into a body id.

    LoadChainId ¶

    LoadChainId :: proc "c" (x: u64) -> ChainId {…}
     

    Load a u64 into a chain id.

    LoadContactId ¶

    LoadContactId :: proc "c" (values: [3]u32) -> ContactId {…}
     

    Load a contact id.

    LoadJointId ¶

    LoadJointId :: proc "c" (x: u64) -> JointId {…}
     

    Load a u64 into a joint id.

    LoadShapeId ¶

    LoadShapeId :: proc "c" (x: u64) -> ShapeId {…}
     

    Load a u64 into a shape id.

    LoadWorldId ¶

    LoadWorldId :: proc "c" (x: u32) -> WorldId {…}
     

    Load a u32 into a world id.

    MAX_AABB_MARGIN ¶

    @(require_results)
    MAX_AABB_MARGIN :: proc "c" () -> f32 {…}
     

    This is used to fatten AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment. This is in meters. Normally this is 5cm.

    MakeAABB ¶

    @(require_results)
    MakeAABB :: proc "c" (points: [][2]f32, radius: f32) -> AABB {…}
     

    Compute the bounding box of an array of circles

    MakeBox ¶

    MakeBox :: proc "c" (halfWidth: f32, halfHeight: f32) -> Polygon ---
     

    Make a box (rectangle) polygon, bypassing the need for a convex hull. @param halfWidth the half-width (x-axis) @param halfHeight the half-height (y-axis)

    External examples raylib/box2d

    MakeOffsetBox ¶
    C · b2MakeOffsetBoxSource · box2d.odin:397

    MakeOffsetBox :: proc "c" (
    	halfWidth:  f32, 
    	halfHeight: f32, 
    	center:     [2]f32, 
    	rotation:   Rot, 
    ) -> Polygon ---
     

    Make an offset box, bypassing the need for a convex hull. @param halfWidth the half-width (x-axis) @param halfHeight the half-height (y-axis) @param center the local center of the box @param rotation the local rotation of the box

    MakeOffsetPolygon ¶
    C · b2MakeOffsetPolygonSource · box2d.odin:401

    MakeOffsetPolygon :: proc "c" (#by_ptr hull: Hull, position: [2]f32, rotation: Rot) -> Polygon ---
     

    Make an offset convex polygon from a convex hull. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

    MakeOffsetProxy ¶

    @(require_results)
    MakeOffsetProxy :: proc "c" (
    	points:   [][2]f32, 
    	radius:   f32, 
    	position: [2]f32, 
    	rotation: Rot, 
    ) -> ShapeProxy {…}
     

    Make a proxy with a transform. This is a deep copy of the points.

    MakeOffsetRoundedBox ¶
    C · b2MakeOffsetRoundedBoxSource · box2d.odin:409

    MakeOffsetRoundedBox :: proc "c" (
    	halfWidth:  f32, 
    	halfHeight: f32, 
    	center:     [2]f32, 
    	rotation:   Rot, 
    	radius:     f32, 
    ) -> Polygon ---
     

    Make an offset rounded box, bypassing the need for a convex hull. @param halfWidth the half-width (x-axis) @param halfHeight the half-height (y-axis) @param center the local center of the box @param rotation the local rotation of the box @param radius the radius of the rounded extension

    MakeOffsetRoundedPolygon ¶
    C · b2MakeOffsetRoundedPolygonSource · box2d.odin:414

    MakeOffsetRoundedPolygon :: proc "c" (
    	#by_ptr hull: Hull, 
    	position: [2]f32, 
    	rotation: Rot, 
    	radius:   f32, 
    ) -> Polygon ---
     

    Make an offset convex polygon from a convex hull with a radius. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

    MakePolygon ¶
    C · b2MakePolygonSource · box2d.odin:418

    MakePolygon :: proc "c" (#by_ptr hull: Hull, radius: f32) -> Polygon ---
     

    Make a convex polygon from a convex hull. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

    MakeProxy ¶

    @(require_results)
    MakeProxy :: proc "c" (points: [][2]f32, radius: f32) -> ShapeProxy {…}
     

    Make a proxy for use in overlap, shape cast, and related functions. This is a deep copy of the points.

    MakeRot ¶

    @(require_results)
    MakeRot :: proc "c" (radians: f32) -> Rot {…}
     

    Make a rotation using an angle in radians

    MakeRotFromUnitVector ¶

    @(require_results)
    MakeRotFromUnitVector :: proc "c" (unitVector: [2]f32) -> Rot {…}
     

    Make a rotation using a unit vector

    MakeRoundedBox ¶
    C · b2MakeRoundedBoxSource · box2d.odin:424

    MakeRoundedBox :: proc "c" (halfWidth: f32, halfHeight: f32, radius: f32) -> Polygon ---
     

    Make a rounded box, bypassing the need for a convex hull. @param halfWidth the half-width (x-axis) @param halfHeight the half-height (y-axis) @param radius the radius of the rounded extension

    MakeSquare ¶
    C · b2MakeSquareSource · box2d.odin:428

    MakeSquare :: proc "c" (halfWidth: f32) -> Polygon ---
     

    Make a square polygon, bypassing the need for a convex hull. @param halfWidth the half-width

    MakeWorldTransform ¶

    @(require_results)
    MakeWorldTransform :: proc "c" (t: Transform) -> Transform {…}
     

    Promote a float transform to a world transform. Lossless.

    Max ¶

    @(require_results)
    Max :: proc "c" (a, b: [2]f32) -> (c: [2]f32) {…}
     

    Component-wise maximum vector

    MaxFloat ¶

    Deprecated. Prefer the built-in 'max(a, b)'
    @(deprecated="Prefer the built-in 'max(a, b)'")
    @(require_results)
    MaxFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the maximum of two floats

    MaxInt ¶

    Deprecated. Prefer the built-in 'max(a, b)'
    @(deprecated="Prefer the built-in 'max(a, b)'")
    @(require_results)
    MaxInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the maximum of two integers

    Min ¶

    @(require_results)
    Min :: proc "c" (a, b: [2]f32) -> (c: [2]f32) {…}
     

    Component-wise minimum vector

    MinFloat ¶

    Deprecated. Prefer the built-in 'min(a, b)'
    @(deprecated="Prefer the built-in 'min(a, b)'")
    @(require_results)
    MinFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the minimum of two floats

    MinInt ¶

    Deprecated. Prefer the built-in 'min(a, b)'
    @(deprecated="Prefer the built-in 'min(a, b)'")
    @(require_results)
    MinInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the minimum of two integers

    MotorJoint_GetAngularDampingRatio ¶
    C · b2MotorJoint_GetAngularDampingRatioSource · box2d.odin:1038

    MotorJoint_GetAngularDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring angular damping ratio.

    MotorJoint_GetAngularHertz ¶
    C · b2MotorJoint_GetAngularHertzSource · box2d.odin:1041

    MotorJoint_GetAngularHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring angular hertz stiffness

    MotorJoint_GetAngularVelocity ¶
    C · b2MotorJoint_GetAngularVelocitySource · box2d.odin:1044

    MotorJoint_GetAngularVelocity :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the desired relative angular velocity in radians per second

    MotorJoint_GetLinearDampingRatio ¶
    C · b2MotorJoint_GetLinearDampingRatioSource · box2d.odin:1047

    MotorJoint_GetLinearDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring linear damping ratio.

    MotorJoint_GetLinearHertz ¶
    C · b2MotorJoint_GetLinearHertzSource · box2d.odin:1050

    MotorJoint_GetLinearHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring linear hertz stiffness

    MotorJoint_GetLinearVelocity ¶
    C · b2MotorJoint_GetLinearVelocitySource · box2d.odin:1053

    MotorJoint_GetLinearVelocity :: proc "c" (jointId: JointId) -> [2]f32 ---
     

    Get the desired relative linear velocity in meters per second

    MotorJoint_GetMaxSpringForce ¶
    C · b2MotorJoint_GetMaxSpringForceSource · box2d.odin:1056

    MotorJoint_GetMaxSpringForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the maximum spring force in newtons.

    MotorJoint_GetMaxSpringTorque ¶
    C · b2MotorJoint_GetMaxSpringTorqueSource · box2d.odin:1059

    MotorJoint_GetMaxSpringTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the maximum spring torque in newtons * meters

    MotorJoint_GetMaxVelocityForce ¶
    C · b2MotorJoint_GetMaxVelocityForceSource · box2d.odin:1062

    MotorJoint_GetMaxVelocityForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the motor joint maximum force, usually in newtons

    MotorJoint_GetMaxVelocityTorque ¶
    C · b2MotorJoint_GetMaxVelocityTorqueSource · box2d.odin:1065

    MotorJoint_GetMaxVelocityTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the motor joint maximum torque, usually in newton-meters

    MotorJoint_SetAngularDampingRatio ¶
    C · b2MotorJoint_SetAngularDampingRatioSource · box2d.odin:1068

    MotorJoint_SetAngularDampingRatio :: proc "c" (jointId: JointId, damping: f32) ---
     

    Set the spring angular damping ratio. Use 1.0 for critical damping.

    MotorJoint_SetAngularHertz ¶
    C · b2MotorJoint_SetAngularHertzSource · box2d.odin:1071

    MotorJoint_SetAngularHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the spring angular hertz stiffness

    MotorJoint_SetAngularVelocity ¶
    C · b2MotorJoint_SetAngularVelocitySource · box2d.odin:1074

    MotorJoint_SetAngularVelocity :: proc "c" (jointId: JointId, velocity: f32) ---
     

    Set the desired relative angular velocity in radians per second

    MotorJoint_SetLinearDampingRatio ¶
    C · b2MotorJoint_SetLinearDampingRatioSource · box2d.odin:1077

    MotorJoint_SetLinearDampingRatio :: proc "c" (jointId: JointId, damping: f32) ---
     

    Set the spring linear damping ratio. Use 1.0 for critical damping.

    MotorJoint_SetLinearHertz ¶
    C · b2MotorJoint_SetLinearHertzSource · box2d.odin:1080

    MotorJoint_SetLinearHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the spring linear hertz stiffness

    MotorJoint_SetLinearVelocity ¶
    C · b2MotorJoint_SetLinearVelocitySource · box2d.odin:1083

    MotorJoint_SetLinearVelocity :: proc "c" (jointId: JointId, velocity: [2]f32) ---
     

    Set the desired relative linear velocity in meters per second

    MotorJoint_SetMaxSpringForce ¶
    C · b2MotorJoint_SetMaxSpringForceSource · box2d.odin:1086

    MotorJoint_SetMaxSpringForce :: proc "c" (jointId: JointId, maxForce: f32) ---
     

    Set the maximum spring force in newtons.

    MotorJoint_SetMaxSpringTorque ¶
    C · b2MotorJoint_SetMaxSpringTorqueSource · box2d.odin:1089

    MotorJoint_SetMaxSpringTorque :: proc "c" (jointId: JointId, maxTorque: f32) ---
     

    Set the maximum spring torque in newtons * meters

    MotorJoint_SetMaxVelocityForce ¶
    C · b2MotorJoint_SetMaxVelocityForceSource · box2d.odin:1092

    MotorJoint_SetMaxVelocityForce :: proc "c" (jointId: JointId, maxForce: f32) ---
     

    Set the motor joint maximum force, usually in newtons

    MotorJoint_SetMaxVelocityTorque ¶
    C · b2MotorJoint_SetMaxVelocityTorqueSource · box2d.odin:1095

    MotorJoint_SetMaxVelocityTorque :: proc "c" (jointId: JointId, maxTorque: f32) ---
     

    Set the motor joint maximum torque, usually in newton-meters

    MoverJoint_GetLinearVelocity ¶
    C · b2MoverJoint_GetLinearVelocitySource · box2d.odin:1102

    MoverJoint_GetLinearVelocity :: proc "c" (jointId: JointId) -> [2]f32 ---
     

    Get the desired relative linear velocity in meters per second

    MoverJoint_GetMaxVelocityForce ¶
    C · b2MoverJoint_GetMaxVelocityForceSource · box2d.odin:1105

    MoverJoint_GetMaxVelocityForce :: proc "c" (jointId: JointId) -> [2]f32 ---
     

    Get the joint maximum force, usually in newtons

    MoverJoint_SetLinearVelocity ¶
    C · b2MoverJoint_SetLinearVelocitySource · box2d.odin:1108

    MoverJoint_SetLinearVelocity :: proc "c" (jointId: JointId, velocity: [2]f32) ---
     

    Set the desired relative linear velocity in meters per second

    MoverJoint_SetMaxVelocityForce ¶
    C · b2MoverJoint_SetMaxVelocityForceSource · box2d.odin:1111

    MoverJoint_SetMaxVelocityForce :: proc "c" (jointId: JointId, maxForce: [2]f32) ---
     

    Set the joint maximum force, usually in newtons

    Mul ¶

    Deprecated. Prefer 'a * b'
    @(deprecated="Prefer 'a * b'")
    @(require_results)
    Mul :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Component-wise multiplication

    MulAdd ¶

    Deprecated. Prefer 'a + s * b'
    @(deprecated="Prefer 'a + s * b'")
    @(require_results)
    MulAdd :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a + s * b

    MulMV ¶

    Deprecated. Prefer 'A * v'
    @(deprecated="Prefer 'A * v'")
    @(require_results)
    MulMV :: proc "c" (A: matrix[2, 2]f32, v: [2]f32) -> [2]f32 {…}
     

    Multiply a 2-by-2 matrix times a 2D vector

    MulRot ¶

    @(require_results)
    MulRot :: proc "c" (q, r: Rot) -> (qr: Rot) {…}
     

    Multiply two rotations: q * r

    MulSV ¶

    Deprecated. Prefer 's * v'
    @(deprecated="Prefer 's * v'")
    @(require_results)
    MulSV :: proc "c" (s: f32, v: [2]f32) -> [2]f32 {…}
     

    Multiply a scalar and vector

    MulSub ¶

    Deprecated. Prefer 'a - s * b'
    @(deprecated="Prefer 'a - s * b'")
    @(require_results)
    MulSub :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a - s * b

    MulTransforms ¶

    @(require_results)
    MulTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}
     

    Multiply two transforms. If the result is applied to a point p local to frame B, the transform would first convert p to a point local to frame A, then into a point in the world frame. v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p

    MulWorldTransforms ¶

    @(require_results)
    MulWorldTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}
     

    Convert a local transform B into world space using world transform A.

    Neg ¶

    Deprecated. Prefer '-a'
    @(deprecated="Prefer '-a'")
    @(require_results)
    Neg :: proc "c" (a: [2]f32) -> [2]f32 {…}
     

    Vector negation

    Normalize ¶

    @(require_results)
    Normalize :: proc "c" (a: [2]f32) -> [2]f32 {…}
     

    Convert a vector into a unit vector if possible, otherwise returns the zero vector.

    NormalizeChecked ¶

    @(require_results)
    NormalizeChecked :: proc(v: [2]f32) -> [2]f32 {…}

    NormalizeRot ¶

    @(require_results)
    NormalizeRot :: proc "c" (q: Rot) -> Rot {…}
     

    Normalize rotation

    OffsetPos ¶

    @(require_results)
    OffsetPos :: proc "c" (p: [2]f32, d: [2]f32) -> [2]f32 {…}
     

    p + d

    PlaneSeparation ¶

    @(require_results)
    PlaneSeparation :: proc "c" (plane: Plane, point: [2]f32) -> f32 {…}
     

    Signed separation of a point from a plane

    PogoJoint_GetCurrentLength ¶
    C · b2PogoJoint_GetCurrentLengthSource · box2d.odin:1118

    PogoJoint_GetCurrentLength :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current length of the pogo.

    PogoJoint_GetCurrentSpeed ¶
    C · b2PogoJoint_GetCurrentSpeedSource · box2d.odin:1121

    PogoJoint_GetCurrentSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the internal pogo velocity.

    PogoJoint_GetImpulse ¶
    C · b2PogoJoint_GetImpulseSource · box2d.odin:1124

    PogoJoint_GetImpulse :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the internal pogo impulse.

    PogoJoint_GetRestLength ¶
    C · b2PogoJoint_GetRestLengthSource · box2d.odin:1127

    PogoJoint_GetRestLength :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the rest length of a pogo joint

    PogoJoint_GetSpringDampingRatio ¶
    C · b2PogoJoint_GetSpringDampingRatioSource · box2d.odin:1130

    PogoJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring damping ratio

    PogoJoint_GetSpringHertz ¶
    C · b2PogoJoint_GetSpringHertzSource · box2d.odin:1133

    PogoJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring Hertz

    PogoJoint_SetRestLength ¶
    C · b2PogoJoint_SetRestLengthSource · box2d.odin:1138

    PogoJoint_SetRestLength :: proc "c" (jointId: JointId, length: f32) ---
     

    Set the rest length of a pogo joint @param jointId The id for a pogo joint @param length The new pogo joint length

    PogoJoint_SetSpringDampingRatio ¶
    C · b2PogoJoint_SetSpringDampingRatioSource · box2d.odin:1141

    PogoJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the spring damping ratio, non-dimensional

    PogoJoint_SetSpringHertz ¶
    C · b2PogoJoint_SetSpringHertzSource · box2d.odin:1144

    PogoJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the spring stiffness in Hertz

    PointInCapsule ¶
    C · b2PointInCapsuleSource · box2d.odin:431

    PointInCapsule :: proc "c" (#by_ptr shape: Capsule, point: [2]f32) -> bool ---
     

    Test a point for overlap with a capsule in local space

    PointInCircle ¶
    C · b2PointInCircleSource · box2d.odin:434

    PointInCircle :: proc "c" (#by_ptr shape: Circle, point: [2]f32) -> bool ---
     

    Test a point for overlap with a circle in local space

    PointInPolygon ¶
    C · b2PointInPolygonSource · box2d.odin:437

    PointInPolygon :: proc "c" (#by_ptr shape: Polygon, point: [2]f32) -> bool ---
     

    Test a point for overlap with a convex polygon in local space

    PrismaticJoint_EnableLimit ¶
    C · b2PrismaticJoint_EnableLimitSource · box2d.odin:1151

    PrismaticJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---
     

    Enable/disable a prismatic joint limit

    PrismaticJoint_EnableMotor ¶
    C · b2PrismaticJoint_EnableMotorSource · box2d.odin:1154

    PrismaticJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---
     

    Enable/disable a prismatic joint motor

    PrismaticJoint_EnableSpring ¶
    C · b2PrismaticJoint_EnableSpringSource · box2d.odin:1157

    PrismaticJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---
     

    Enable/disable the joint spring.

    PrismaticJoint_GetCurrentMotorForce ¶
    C · b2PrismaticJoint_GetCurrentMotorForceSource · box2d.odin:1160

    PrismaticJoint_GetCurrentMotorForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint current motor force, usually in newtons

    PrismaticJoint_GetCurrentSpeed ¶
    C · b2PrismaticJoint_GetCurrentSpeedSource · box2d.odin:1163

    PrismaticJoint_GetCurrentSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current joint translation velocity, usually in meters per second.

    PrismaticJoint_GetCurrentTranslation ¶
    C · b2PrismaticJoint_GetCurrentTranslationSource · box2d.odin:1166

    PrismaticJoint_GetCurrentTranslation :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current joint translation, usually in meters.

    PrismaticJoint_GetLowerLimit ¶
    C · b2PrismaticJoint_GetLowerLimitSource · box2d.odin:1169

    PrismaticJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint lower limit

    PrismaticJoint_GetMaxMotorForce ¶
    C · b2PrismaticJoint_GetMaxMotorForceSource · box2d.odin:1172

    PrismaticJoint_GetMaxMotorForce :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint maximum motor force, usually in newtons

    PrismaticJoint_GetSpringDampingRatio ¶
    C · b2PrismaticJoint_GetSpringDampingRatioSource · box2d.odin:1175

    PrismaticJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic spring damping ratio (non-dimensional)

    PrismaticJoint_GetSpringHertz ¶
    C · b2PrismaticJoint_GetSpringHertzSource · box2d.odin:1178

    PrismaticJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint stiffness in Hertz

    PrismaticJoint_GetTargetMotorSpeed ¶
    C · b2PrismaticJoint_GetTargetMotorSpeedSource · box2d.odin:1181

    PrismaticJoint_GetTargetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint motor speed, usually in meters per second

    PrismaticJoint_GetTargetTranslation ¶
    C · b2PrismaticJoint_GetTargetTranslationSource · box2d.odin:1184

    PrismaticJoint_GetTargetTranslation :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint spring target translation, usually in meters

    PrismaticJoint_GetUpperLimit ¶
    C · b2PrismaticJoint_GetUpperLimitSource · box2d.odin:1187

    PrismaticJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the prismatic joint upper limit

    PrismaticJoint_IsLimitEnabled ¶
    C · b2PrismaticJoint_IsLimitEnabledSource · box2d.odin:1190

    PrismaticJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the prismatic joint limit enabled?

    PrismaticJoint_IsMotorEnabled ¶
    C · b2PrismaticJoint_IsMotorEnabledSource · box2d.odin:1193

    PrismaticJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the prismatic joint motor enabled?

    PrismaticJoint_IsSpringEnabled ¶
    C · b2PrismaticJoint_IsSpringEnabledSource · box2d.odin:1196

    PrismaticJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the prismatic joint spring enabled or not?

    PrismaticJoint_SetLimits ¶
    C · b2PrismaticJoint_SetLimitsSource · box2d.odin:1199

    PrismaticJoint_SetLimits :: proc "c" (jointId: JointId, lower: f32, upper: f32) ---
     

    Set the prismatic joint limits

    PrismaticJoint_SetMaxMotorForce ¶
    C · b2PrismaticJoint_SetMaxMotorForceSource · box2d.odin:1202

    PrismaticJoint_SetMaxMotorForce :: proc "c" (jointId: JointId, force: f32) ---
     

    Set the prismatic joint maximum motor force, usually in newtons

    PrismaticJoint_SetSpringDampingRatio ¶
    C · b2PrismaticJoint_SetSpringDampingRatioSource · box2d.odin:1205

    PrismaticJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the prismatic joint damping ratio (non-dimensional)

    PrismaticJoint_SetSpringHertz ¶
    C · b2PrismaticJoint_SetSpringHertzSource · box2d.odin:1210

    PrismaticJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the prismatic joint stiffness in Hertz. This should usually be less than a quarter of the simulation rate. For example, if the simulation runs at 60Hz then the joint stiffness should be 15Hz or less.

    PrismaticJoint_SetTargetMotorSpeed ¶
    C · b2PrismaticJoint_SetTargetMotorSpeedSource · box2d.odin:1213

    PrismaticJoint_SetTargetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---
     

    Set the prismatic joint motor speed, usually in meters per second

    PrismaticJoint_SetTargetTranslation ¶
    C · b2PrismaticJoint_SetTargetTranslationSource · box2d.odin:1216

    PrismaticJoint_SetTargetTranslation :: proc "c" (jointId: JointId, translation: f32) ---
     

    Set the prismatic joint spring target translation, usually in meters

    Recording_GetData ¶
    C · b2Recording_GetDataSource · box2d.odin:1224

    Recording_GetData :: proc "c" (recording: ^Recording) -> [^]u8 ---
     

    Get a pointer to the recorded bytes, for saving to a file or transmitting. Valid until the next recording call or b2DestroyRecording.

    Recording_GetSize ¶
    C · b2Recording_GetSizeSource · box2d.odin:1227

    Recording_GetSize :: proc "c" (recording: ^Recording) -> i32 ---
     

    Get the number of recorded bytes.

    Recording_SaveToFile ¶
    C · b2Recording_SaveToFileSource · box2d.odin:1231

    Recording_SaveToFile :: proc "c" (recording: ^Recording, path: cstring) -> bool ---
     

    Save a recording buffer to a file. Convenience wrapper over your own file I/O. @return false if the file could not be written

    RelativeAngle ¶

    @(require_results)
    RelativeAngle :: proc "c" (a, b: Rot) -> f32 {…}
     

    The angle of rotation b relative to rotation a. Radians.

    Replay_DrawFrameQueries ¶
    C · b2Replay_DrawFrameQueriesSource · box2d.odin:1242

    Replay_DrawFrameQueries :: proc "c" (player: ^Replay, draw: ^DebugDraw, queryIndex: i32) ---
     

    Draw spatial queries recorded during the most recently replayed frame. Call after b2World_Draw so queries are layered on top of the world. @param player A valid player handle @param draw Debug draw callbacks. NULL draw function pointers are skipped. @param queryIndex Index into the frame's queries to draw, or -1 to draw all of them.

    Replay_GetBodyCount ¶
    C · b2Replay_GetBodyCountSource · box2d.odin:1246

    Replay_GetBodyCount :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the number of body slots tracked for the outliner. This is the creation-order span and includes holes for destroyed bodies, so it only grows as the replay advances.

    Replay_GetBodyId ¶
    C · b2Replay_GetBodyIdSource · box2d.odin:1250

    Replay_GetBodyId :: proc "c" (player: ^Replay, index: i32) -> BodyId ---
     

    Get a tracked body by creation ordinal. Returns b2_nullBodyId for a destroyed slot, an ordinal not yet reached at the current frame, or an out-of-range index. Validate with b2Body_IsValid.

    Replay_GetDivergeFrame ¶
    C · b2Replay_GetDivergeFrameSource · box2d.odin:1253

    Replay_GetDivergeFrame :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the first step at which replay diverged, or -1 if it has not diverged.

    Replay_GetFrame ¶
    C · b2Replay_GetFrameSource · box2d.odin:1256

    Replay_GetFrame :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the number of steps replayed so far.

    Replay_GetFrameQuery ¶
    C · b2Replay_GetFrameQuerySource · box2d.odin:1259

    Replay_GetFrameQuery :: proc "c" (player: ^Replay, index: i32) -> ReplayQueryInfo ---
     

    Get a recorded query from the most recently replayed frame by index.

    Replay_GetFrameQueryCount ¶
    C · b2Replay_GetFrameQueryCountSource · box2d.odin:1262

    Replay_GetFrameQueryCount :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the number of spatial queries recorded for the most recently replayed frame.

    Replay_GetFrameQueryHit ¶
    C · b2Replay_GetFrameQueryHitSource · box2d.odin:1265

    Replay_GetFrameQueryHit :: proc "c" (
    	player:     ^Replay, 
    	queryIndex: i32, 
    	hitIndex:   i32, 
    ) -> ReplayQueryHit ---
     

    Get one result of a recorded query from the most recently replayed frame.

    Replay_GetInfo ¶
    C · b2Replay_GetInfoSource · box2d.odin:1268

    Replay_GetInfo :: proc "c" (player: ^Replay) -> ReplayInfo ---
     

    Get static metadata for the recording (frame count, recorded tuning, time).

    Replay_GetKeyframeBudget ¶
    C · b2Replay_GetKeyframeBudgetSource · box2d.odin:1271

    Replay_GetKeyframeBudget :: proc "c" (player: ^Replay) -> uint ---
     

    Get the keyframe memory budget in bytes.

    Replay_GetKeyframeBytes ¶
    C · b2Replay_GetKeyframeBytesSource · box2d.odin:1274

    Replay_GetKeyframeBytes :: proc "c" (player: ^Replay) -> uint ---
     

    Get the memory currently held by keyframe snapshots, in bytes.

    Replay_GetKeyframeInterval ¶
    C · b2Replay_GetKeyframeIntervalSource · box2d.odin:1278

    Replay_GetKeyframeInterval :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the current keyframe spacing in frames. Starts at the min interval and doubles as the ring evicts to stay under budget, so it reflects the effective backward-seek granularity right now.

    Replay_GetKeyframeMinInterval ¶
    C · b2Replay_GetKeyframeMinIntervalSource · box2d.odin:1281

    Replay_GetKeyframeMinInterval :: proc "c" (player: ^Replay) -> i32 ---
     

    Get the finest keyframe spacing in frames.

    Replay_GetWorldId ¶
    C · b2Replay_GetWorldIdSource · box2d.odin:1284

    Replay_GetWorldId :: proc "c" (player: ^Replay) -> WorldId ---
     

    Get the id of the replayed world.

    Replay_HasDiverged ¶
    C · b2Replay_HasDivergedSource · box2d.odin:1287

    Replay_HasDiverged :: proc "c" (player: ^Replay) -> bool ---
     

    Returns true if a recorded state hash failed to reproduce, meaning replay diverged.

    Replay_IsAtEnd ¶
    C · b2Replay_IsAtEndSource · box2d.odin:1290

    Replay_IsAtEnd :: proc "c" (player: ^Replay) -> bool ---
     

    Returns true once the end of the recording has been reached.

    Replay_Restart ¶
    C · b2Replay_RestartSource · box2d.odin:1293

    Replay_Restart :: proc "c" (player: ^Replay) ---
     

    Rewind the player to the first step, recreating the replay world from the file.

    Replay_SeekFrame ¶
    C · b2Replay_SeekFrameSource · box2d.odin:1297

    Replay_SeekFrame :: proc "c" (player: ^Replay, targetFrame: i32) ---
     

    Seek to a recorded step. Seeking backward rewinds and re-runs from the nearest keyframe. Clamps to the recording bounds.

    Replay_SetKeyframePolicy ¶
    C · b2Replay_SetKeyframePolicySource · box2d.odin:1304

    Replay_SetKeyframePolicy :: proc "c" (
    	player:            ^Replay, 
    	budgetBytes:       uint, 
    	minIntervalFrames: i32, 
    ) ---
     

    Tune the keyframe ring used to speed up backward seeking. A keyframe is a periodic snapshot the player restores from instead of replaying from the start, trading memory for seek speed. @param player the recording player @param budgetBytes Memory cap for the kept snapshots. The spacing widens to stay under it. @param minIntervalFrames Finest spacing between keyframes, in frames.

    Replay_StepFrame ¶
    C · b2Replay_StepFrameSource · box2d.odin:1308

    Replay_StepFrame :: proc "c" (player: ^Replay) -> bool ---
     

    Advance the replay by one recorded step. @return true if a step executed, false once the end of the recording is reached

    RevoluteJoint_EnableLimit ¶
    C · b2RevoluteJoint_EnableLimitSource · box2d.odin:1315

    RevoluteJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---
     

    Enable/disable the revolute joint limit

    RevoluteJoint_EnableMotor ¶
    C · b2RevoluteJoint_EnableMotorSource · box2d.odin:1318

    RevoluteJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---
     

    Enable/disable a revolute joint motor

    RevoluteJoint_EnableSpring ¶
    C · b2RevoluteJoint_EnableSpringSource · box2d.odin:1321

    RevoluteJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---
     

    Enable/disable the revolute joint spring

    RevoluteJoint_GetCurrentAngle ¶
    C · b2RevoluteJoint_GetCurrentAngleSource · box2d.odin:1325

    RevoluteJoint_GetCurrentAngle :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint current angle in radians. This is the relative rotation of the joint frames.

    RevoluteJoint_GetCurrentMotorTorque ¶
    C · b2RevoluteJoint_GetCurrentMotorTorqueSource · box2d.odin:1328

    RevoluteJoint_GetCurrentMotorTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint current motor torque, usually in newton-meters

    RevoluteJoint_GetCurrentSpeed ¶
    C · b2RevoluteJoint_GetCurrentSpeedSource · box2d.odin:1331

    RevoluteJoint_GetCurrentSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the current revolute joint motor speed in radians per second

    RevoluteJoint_GetLowerLimit ¶
    C · b2RevoluteJoint_GetLowerLimitSource · box2d.odin:1334

    RevoluteJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint lower limit in radians

    RevoluteJoint_GetMaxMotorTorque ¶
    C · b2RevoluteJoint_GetMaxMotorTorqueSource · box2d.odin:1337

    RevoluteJoint_GetMaxMotorTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint maximum motor torque, usually in newton-meters

    RevoluteJoint_GetSpringDampingRatio ¶
    C · b2RevoluteJoint_GetSpringDampingRatioSource · box2d.odin:1340

    RevoluteJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_GetSpringHertz ¶
    C · b2RevoluteJoint_GetSpringHertzSource · box2d.odin:1343

    RevoluteJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint spring stiffness in Hertz

    RevoluteJoint_GetTargetAngle ¶
    C · b2RevoluteJoint_GetTargetAngleSource · box2d.odin:1346

    RevoluteJoint_GetTargetAngle :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint spring target angle, radians

    RevoluteJoint_GetTargetMotorSpeed ¶
    C · b2RevoluteJoint_GetTargetMotorSpeedSource · box2d.odin:1349

    RevoluteJoint_GetTargetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint motor speed in radians per second

    RevoluteJoint_GetUpperLimit ¶
    C · b2RevoluteJoint_GetUpperLimitSource · box2d.odin:1352

    RevoluteJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the revolute joint upper limit in radians

    RevoluteJoint_IsLimitEnabled ¶
    C · b2RevoluteJoint_IsLimitEnabledSource · box2d.odin:1355

    RevoluteJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the revolute joint limit enabled?

    RevoluteJoint_IsMotorEnabled ¶
    C · b2RevoluteJoint_IsMotorEnabledSource · box2d.odin:1358

    RevoluteJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the revolute joint motor enabled?

    RevoluteJoint_IsSpringEnabled ¶
    C · b2RevoluteJoint_IsSpringEnabledSource · box2d.odin:1361

    RevoluteJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the revolute angular spring enabled?

    RevoluteJoint_SetLimits ¶
    C · b2RevoluteJoint_SetLimitsSource · box2d.odin:1365

    RevoluteJoint_SetLimits :: proc "c" (jointId: JointId, lower: f32, upper: f32) ---
     

    Set the revolute joint limits in radians. It is expected that lower <= upper and that -0.99 * B2_PI <= lower && upper <= 0.99 * B2_PI.

    RevoluteJoint_SetMaxMotorTorque ¶
    C · b2RevoluteJoint_SetMaxMotorTorqueSource · box2d.odin:1368

    RevoluteJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---
     

    Set the revolute joint maximum motor torque, usually in newton-meters

    RevoluteJoint_SetSpringDampingRatio ¶
    C · b2RevoluteJoint_SetSpringDampingRatioSource · box2d.odin:1371

    RevoluteJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_SetSpringHertz ¶
    C · b2RevoluteJoint_SetSpringHertzSource · box2d.odin:1374

    RevoluteJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the revolute joint spring stiffness in Hertz

    RevoluteJoint_SetTargetAngle ¶
    C · b2RevoluteJoint_SetTargetAngleSource · box2d.odin:1377

    RevoluteJoint_SetTargetAngle :: proc "c" (jointId: JointId, angle: f32) ---
     

    Set the revolute joint spring target angle, radians

    RevoluteJoint_SetTargetMotorSpeed ¶
    C · b2RevoluteJoint_SetTargetMotorSpeedSource · box2d.odin:1380

    RevoluteJoint_SetTargetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---
     

    Set the revolute joint motor speed in radians per second

    RightPerp ¶

    @(require_results)
    RightPerp :: proc "c" (v: [2]f32) -> [2]f32 {…}
     

    Get a right pointing perpendicular vector. Equivalent to b2CrossVS(v, 1)

    Rot_GetAngle ¶

    @(require_results)
    Rot_GetAngle :: proc "c" (q: Rot) -> f32 {…}
     

    Get the angle in radians in the range [-pi, pi]

    External examples raylib/box2d

    Rot_GetXAxis ¶

    @(require_results)
    Rot_GetXAxis :: proc "c" (q: Rot) -> [2]f32 {…}
     

    Get the x-axis

    Rot_GetYAxis ¶

    @(require_results)
    Rot_GetYAxis :: proc "c" (q: Rot) -> [2]f32 {…}
     

    Get the y-axis

    RotateVector ¶

    @(require_results)
    RotateVector :: proc "c" (q: Rot, v: [2]f32) -> [2]f32 {…}
     

    Rotate a vector

    RoundDownFloat ¶

    @(require_results)
    RoundDownFloat :: proc "c" (x: f64) -> f32 {…}
     

    Narrow a world coordinate to float, rounding toward negative infinity. With large world mode off this is a plain conversion.

    RoundUpFloat ¶

    @(require_results)
    RoundUpFloat :: proc "c" (x: f64) -> f32 {…}
     

    Narrow a world coordinate to float, rounding toward positive infinity. With large world mode off this is a plain conversion.

    SPECULATIVE_DISTANCE ¶

    @(require_results)
    SPECULATIVE_DISTANCE :: proc "c" () -> f32 {…}
     

    Box2D uses limited speculative collision. This reduces jitter. Normally this is 2cm.

    SetAllocator ¶
    C · b2SetAllocatorSource · box2d.odin:441

    SetAllocator :: proc "c" (allocFcn: AllocCallbackFcn, freeFcn: FreeCallbackFcn) ---
     

    This allows the user to override the allocation functions. These should be set during application startup.

    SetAssertCallback ¶
    C · b2SetAssertCallbackSource · box2d.odin:445

    SetAssertCallback :: proc "c" (assertFcn: AssertCallbackFcn) ---
     

    Override the default assert function @param assertFcn a non-null assert callback

    SetLengthUnitsPerMeter ¶
    C · b2SetLengthUnitsPerMeterSource · box2d.odin:459

    SetLengthUnitsPerMeter :: proc "c" (lengthUnits: f32) ---
     

    Box2D bases all length units on meters, but you may need different units for your game. You can set this value to use different units. This should be done at application startup and only modified once. Default value is 1. For example, if your game uses pixels for units you can use pixels for all length values sent to Box2D. There should be no extra cost. However, Box2D has some internal tolerances and thresholds that have been tuned for meters. By calling this function, Box2D is able to adjust those tolerances and thresholds to improve accuracy. A good rule of thumb is to pass the height of your player character to this function. So if your player character is 32 pixels high, then pass 32 to this function. Then you may confidently use pixels for all the length values sent to Box2D. All length values returned from Box2D will also be pixels because Box2D does not do any scaling internally. However, you are now on the hook for coming up with good values for gravity, density, and forces. @warning This must be modified before any calls to Box2D

    External examples raylib/box2d

    SetLogCallback ¶
    C · b2SetLogCallbackSource · box2d.odin:463

    SetLogCallback :: proc "c" (logFcn: LogCallbackFcn) ---
     

    Override the default log function @param logFcn a non-null log callback

    Shape_ApplyWind ¶
    C · b2Shape_ApplyWindSource · box2d.odin:1394

    Shape_ApplyWind :: proc "c" (shapeId: ShapeId, wind: [2]f32, drag: f32, lift: f32, wake: bool) ---
     

    Apply a wind force to the body for this shape using the density of air. This considers the projected area of the shape in the wind direction. This also considers the relative velocity of the shape. @param shapeId the shape id @param wind the wind velocity in world space @param drag the drag coefficient, the force that opposes the relative velocity @param lift the lift coefficient, the force that is perpendicular to the relative velocity @param wake should this wake the body

    Shape_AreContactEventsEnabled ¶
    C · b2Shape_AreContactEventsEnabledSource · box2d.odin:1397

    Shape_AreContactEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if contact events are enabled

    Shape_AreHitEventsEnabled ¶
    C · b2Shape_AreHitEventsEnabledSource · box2d.odin:1400

    Shape_AreHitEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if hit events are enabled

    Shape_ArePreSolveEventsEnabled ¶
    C · b2Shape_ArePreSolveEventsEnabledSource · box2d.odin:1403

    Shape_ArePreSolveEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if pre-solve events are enabled

    Shape_AreSensorEventsEnabled ¶
    C · b2Shape_AreSensorEventsEnabledSource · box2d.odin:1406

    Shape_AreSensorEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if sensor events are enabled.

    Shape_CastRay ¶
    C · b2Shape_CastRaySource · box2d.odin:1410

    Shape_CastRay :: proc "c" (
    	shapeId:     ShapeId, 
    	origin:      [2]f32, 
    	translation: [2]f32, 
    ) -> CastOutput ---
     

    Ray cast a single shape. The ray starts at the origin and extends by the translation. The output point is a world position.

    Shape_ComputeMassData ¶
    C · b2Shape_ComputeMassDataSource · box2d.odin:1413

    Shape_ComputeMassData :: proc "c" (shapeId: ShapeId) -> MassData ---
     

    Compute the mass data for a shape

    Shape_EnableContactEvents ¶
    C · b2Shape_EnableContactEventsSource · box2d.odin:1419

    Shape_EnableContactEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. @see b2ShapeDef::enableContactEvents @warning changing this at run-time may lead to lost begin/end events

    Shape_EnableHitEvents ¶
    C · b2Shape_EnableHitEventsSource · box2d.odin:1423

    Shape_EnableHitEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable contact hit events for this shape. Ignored for sensors. @see b2WorldDef::hitEventThreshold

    Shape_EnablePreSolveEvents ¶
    C · b2Shape_EnablePreSolveEventsSource · box2d.odin:1428

    Shape_EnablePreSolveEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to multithreading. Ignored for sensors. @see b2PreSolveCallbackFcn

    Shape_EnableSensorEvents ¶
    C · b2Shape_EnableSensorEventsSource · box2d.odin:1432

    Shape_EnableSensorEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable sensor events for this shape. @see b2ShapeDef::enableSensorEvents

    Shape_GetBody ¶
    C · b2Shape_GetBodySource · box2d.odin:1435

    Shape_GetBody :: proc "c" (shapeId: ShapeId) -> BodyId ---
     

    Get the id of the body that a shape is attached to

    Shape_GetBounds ¶
    C · b2Shape_GetBoundsSource · box2d.odin:1438

    Shape_GetBounds :: proc "c" (shapeId: ShapeId) -> AABB ---
     

    Get the current world AABB

    Shape_GetCapsule ¶
    C · b2Shape_GetCapsuleSource · box2d.odin:1441

    Shape_GetCapsule :: proc "c" (shapeId: ShapeId) -> Capsule ---
     

    Get a copy of the shape's capsule. Asserts the type is correct.

    Shape_GetChainSegment ¶
    C · b2Shape_GetChainSegmentSource · box2d.odin:1445

    Shape_GetChainSegment :: proc "c" (shapeId: ShapeId) -> ChainSegment ---
     

    Get a copy of the shape's chain segment. These come from chain shapes. Asserts the type is correct.

    Shape_GetCircle ¶
    C · b2Shape_GetCircleSource · box2d.odin:1448

    Shape_GetCircle :: proc "c" (shapeId: ShapeId) -> Circle ---
     

    Get a copy of the shape's circle. Asserts the type is correct.

    Shape_GetClosestPoint ¶
    C · b2Shape_GetClosestPointSource · box2d.odin:1451

    Shape_GetClosestPoint :: proc "c" (shapeId: ShapeId, target: [2]f32) -> [2]f32 ---
     

    Get the closest point on a shape to a target point. Target and result are world positions.

    Shape_GetContactCapacity ¶
    C · b2Shape_GetContactCapacitySource · box2d.odin:1454

    Shape_GetContactCapacity :: proc "c" (shapeId: ShapeId) -> i32 ---
     

    Get the maximum capacity required for retrieving all the touching contacts on a shape

    Shape_GetContactData ¶

    @(require_results)
    Shape_GetContactData :: proc "c" (
    	shapeId:     ShapeId, 
    	contactData: []ContactData, 
    ) -> []ContactData {…}
     

    Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data. @note Box2D uses speculative collision so some contact points may be separated. @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements

    Shape_GetDensity ¶
    C · b2Shape_GetDensitySource · box2d.odin:1457

    Shape_GetDensity :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the density of a shape, usually in kg/m^2

    Shape_GetFilter ¶
    C · b2Shape_GetFilterSource · box2d.odin:1460

    Shape_GetFilter :: proc "c" (shapeId: ShapeId) -> Filter ---
     

    Get the shape filter

    Shape_GetFriction ¶
    C · b2Shape_GetFrictionSource · box2d.odin:1463

    Shape_GetFriction :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the friction of a shape

    Shape_GetParentChain ¶
    C · b2Shape_GetParentChainSource · box2d.odin:1466

    Shape_GetParentChain :: proc "c" (shapeId: ShapeId) -> ChainId ---
     

    Get the parent chain id if the shape type is a chain segment, otherwise returns b2_nullChainId.

    Shape_GetPolygon ¶
    C · b2Shape_GetPolygonSource · box2d.odin:1469

    Shape_GetPolygon :: proc "c" (shapeId: ShapeId) -> Polygon ---
     

    Get a copy of the shape's convex polygon. Asserts the type is correct.

    Shape_GetRestitution ¶
    C · b2Shape_GetRestitutionSource · box2d.odin:1472

    Shape_GetRestitution :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the shape restitution

    Shape_GetSegment ¶
    C · b2Shape_GetSegmentSource · box2d.odin:1475

    Shape_GetSegment :: proc "c" (shapeId: ShapeId) -> Segment ---
     

    Get a copy of the shape's line segment. Asserts the type is correct.

    Shape_GetSensorCapacity ¶
    C · b2Shape_GetSensorCapacitySource · box2d.odin:1481

    Shape_GetSensorCapacity :: proc "c" (shapeId: ShapeId) -> i32 ---
     

    Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape. This returns 0 if the provided shape is not a sensor. @param shapeId the id of a sensor shape @returns the required capacity to get all the overlaps in b2Shape_GetSensorData

    Shape_GetSensorData ¶

    @(require_results)
    Shape_GetSensorData :: proc "c" (shapeId: ShapeId, visitorIds: []ShapeId) -> []ShapeId {…}
     

    Get the overlap data for a sensor shape computed during the previous world step. @param shapeId the id of a sensor shape @param visitorIds a user allocated array that is filled with the overlapping shapes (visitors) @param capacity the capacity of visitorIds @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements @warning overlaps may contain destroyed shapes so use b2Shape_IsValid to confirm each overlap

    Shape_GetSurfaceMaterial ¶
    C · b2Shape_GetSurfaceMaterialSource · box2d.odin:1484

    Shape_GetSurfaceMaterial :: proc "c" (shapeId: ShapeId) -> SurfaceMaterial ---
     

    Get the shape surface material

    Shape_GetType ¶
    C · b2Shape_GetTypeSource · box2d.odin:1487

    Shape_GetType :: proc "c" (shapeId: ShapeId) -> ShapeType ---
     

    Get the type of a shape

    Shape_GetUserData ¶
    C · b2Shape_GetUserDataSource · box2d.odin:1490

    Shape_GetUserData :: proc "c" (shapeId: ShapeId) -> rawptr ---
     

    Get the user data for a shape. This is useful when you get a shape id from an event or query.

    Shape_GetUserMaterial ¶
    C · b2Shape_GetUserMaterialSource · box2d.odin:1493

    Shape_GetUserMaterial :: proc "c" (shapeId: ShapeId) -> u64 ---
     

    Get the user material identifier

    Shape_GetWorld ¶
    C · b2Shape_GetWorldSource · box2d.odin:1496

    Shape_GetWorld :: proc "c" (shapeId: ShapeId) -> WorldId ---
     

    Get the world that owns this shape

    Shape_IsSensor ¶
    C · b2Shape_IsSensorSource · box2d.odin:1500

    Shape_IsSensor :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if the shape is a sensor. It is not possible to change a shape from sensor to solid dynamically because this breaks the contract for sensor events.

    Shape_IsValid ¶
    C · b2Shape_IsValidSource · box2d.odin:1503

    Shape_IsValid :: proc "c" (id: ShapeId) -> bool ---
     

    Shape identifier validation. Provides validation for up to 64K allocations.

    Shape_SetCapsule ¶
    C · b2Shape_SetCapsuleSource · box2d.odin:1508

    Shape_SetCapsule :: proc "c" (shapeId: ShapeId, #by_ptr capsule: Capsule) ---
     

    Allows you to change a shape to be a capsule or update the current capsule. This does not modify the mass properties. @see b2Body_UpdateMassFromShapes

    Shape_SetChainSegment ¶
    C · b2Shape_SetChainSegmentSource · box2d.odin:1513

    Shape_SetChainSegment :: proc "c" (shapeId: ShapeId, #by_ptr chainSegment: ChainSegment) ---
     

    Allows you to change a shape to be a loose chain segment or update the current chain segment. The resulting shape does not belong to a chain shape. Asserts if the shape is already a chain segment owned by a chain shape (chainId != B2_NULL_INDEX).

    Shape_SetCircle ¶
    C · b2Shape_SetCircleSource · box2d.odin:1518

    Shape_SetCircle :: proc "c" (shapeId: ShapeId, #by_ptr circle: Circle) ---
     

    Allows you to change a shape to be a circle or update the current circle. This does not modify the mass properties. @see b2Body_UpdateMassFromShapes

    Shape_SetDensity ¶
    C · b2Shape_SetDensitySource · box2d.odin:1523

    Shape_SetDensity :: proc "c" (shapeId: ShapeId, density: f32, updateBodyMass: bool) ---
     

    Set the mass density of a shape, usually in kg/m^2. This will optionally update the mass properties on the parent body. @see b2ShapeDef::density, b2Body_UpdateMassFromShapes

    Shape_SetFilter ¶
    C · b2Shape_SetFilterSource · box2d.odin:1529

    Shape_SetFilter :: proc "c" (shapeId: ShapeId, filter: Filter) ---
     

    Set the current filter. This is almost as expensive as recreating the shape. This may cause contacts to be immediately destroyed. However contacts are not created until the next world step. Sensor overlap state is also not updated until the next world step. @see b2ShapeDef::filter

    Shape_SetFriction ¶
    C · b2Shape_SetFrictionSource · box2d.odin:1532

    Shape_SetFriction :: proc "c" (shapeId: ShapeId, friction: f32) ---
     

    Set the friction on a shape

    Shape_SetPolygon ¶
    C · b2Shape_SetPolygonSource · box2d.odin:1537

    Shape_SetPolygon :: proc "c" (shapeId: ShapeId, #by_ptr polygon: Polygon) ---
     

    Allows you to change a shape to be a polygon or update the current polygon. This does not modify the mass properties. @see b2Body_UpdateMassFromShapes

    Shape_SetRestitution ¶
    C · b2Shape_SetRestitutionSource · box2d.odin:1540

    Shape_SetRestitution :: proc "c" (shapeId: ShapeId, restitution: f32) ---
     

    Set the shape restitution (bounciness)

    Shape_SetSegment ¶
    C · b2Shape_SetSegmentSource · box2d.odin:1543

    Shape_SetSegment :: proc "c" (shapeId: ShapeId, #by_ptr segment: Segment) ---
     

    Allows you to change a shape to be a segment or update the current segment.

    Shape_SetSurfaceMaterial ¶
    C · b2Shape_SetSurfaceMaterialSource · box2d.odin:1546

    Shape_SetSurfaceMaterial :: proc "c" (
    	shapeId:         ShapeId, 
    	#by_ptr surfaceMaterial: SurfaceMaterial, 
    ) ---
     

    Set the shape surface material

    Shape_SetUserData ¶
    C · b2Shape_SetUserDataSource · box2d.odin:1549

    Shape_SetUserData :: proc "c" (shapeId: ShapeId, userData: rawptr) ---
     

    Set the user data for a shape

    Shape_SetUserMaterial ¶
    C · b2Shape_SetUserMaterialSource · box2d.odin:1552

    Shape_SetUserMaterial :: proc "c" (shapeId: ShapeId, material: u64) ---
     

    Set the user material identifier

    Shape_TestPoint ¶
    C · b2Shape_TestPointSource · box2d.odin:1555

    Shape_TestPoint :: proc "c" (shapeId: ShapeId, point: [2]f32) -> bool ---
     

    Test a world point for overlap with a shape

    Solve22 ¶

    @(require_results)
    Solve22 :: proc "c" (A: matrix[2, 2]f32, b: [2]f32) -> [2]f32 {…}
     

    Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.

    SolvePlanes ¶

    @(require_results)
    SolvePlanes :: proc "c" (targetDelta: [2]f32, planes: []CollisionPlane) -> PlaneSolverResult {…}
     

    Solves the position of a mover that satisfies the given collision planes. @param targetDelta the desired translation from the position used to generate the collision planes @param planes the collision planes @param count the number of collision planes

    SpringDamper ¶

    @(require_results)
    SpringDamper :: proc "c" (hertz, dampingRatio, position, velocity, timeStep: f32) -> f32 {…}
     

    One-dimensional mass-spring-damper simulation. Returns the new velocity given the position and time step. You can then compute the new position using: position += timeStep * newVelocity This drives towards a zero position. By using implicit integration we get a stable solution that doesn't require transcendental functions.

    StoreBodyId ¶

    StoreBodyId :: proc "c" (id: BodyId) -> u64 {…}
     

    Store a body id into a u64.

    StoreChainId ¶

    StoreChainId :: proc "c" (id: ChainId) -> u64 {…}
     

    Store a chain id into a u64.

    StoreContactId ¶

    StoreContactId :: proc "c" (id: ContactId) -> (values: [3]u32) {…}
     

    Store a contact id.

    StoreJointId ¶

    StoreJointId :: proc "c" (id: JointId) -> u64 {…}
     

    Store a joint id into a u64.

    StoreShapeId ¶

    StoreShapeId :: proc "c" (id: ShapeId) -> u64 {…}
     

    Store a shape id into a u64.

    StoreWorldId ¶

    StoreWorldId :: proc "c" (id: WorldId) -> u32 {…}
     

    Store a world id into a u32.

    Sub ¶

    Deprecated. Prefer 'a - b'
    @(deprecated="Prefer 'a - b'")
    @(require_results)
    Sub :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Vector subtraction

    SubPos ¶

    @(require_results)
    SubPos :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    a - b, demoted to float. The primary precision boundary operation.

    ToPos ¶

    @(require_results)
    ToPos :: proc "c" (v: [2]f32) -> [2]f32 {…}
     

    Convert a vector to a world position. No-op in single precision.

    ToRelativeTransform ¶

    @(require_results)
    ToRelativeTransform :: proc "c" (t: Transform, base: [2]f32) -> (r: Transform) {…}
     

    Shift a world transform into the frame of a base position.

    ToVec2 ¶

    @(require_results)
    ToVec2 :: proc "c" (p: [2]f32) -> [2]f32 {…}
     

    Lossy conversion of a world position to a float vector. No-op in single precision.

    TransformPoint ¶

    @(require_results)
    TransformPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}
     

    Transform a point (e.g. local space to world space)

    TransformPolygon ¶
    C · b2TransformPolygonSource · box2d.odin:466

    TransformPolygon :: proc "c" (transform: Transform, #by_ptr polygon: Polygon) -> Polygon ---
     

    Transform a polygon. This is useful for transferring a shape from one body to another.

    TransformWorldPoint ¶

    @(require_results)
    TransformWorldPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}
     

    Transform a local point to a world position. Rotation in float, translation in double.

    UnwindAngle ¶

    @(require_results)
    UnwindAngle :: proc "c" (radians: f32) -> f32 {…}
     

    Convert any angle into the range [-pi, pi]. This does not work well with huge angles, so unwind your angles regularly.

    ValidateHull ¶
    C · b2ValidateHullSource · box2d.odin:473

    ValidateHull :: proc "c" (#by_ptr hull: Hull) -> bool ---
     

    This determines if a hull is valid. Checks for:

    • convexity
    • collinear points

    This is expensive and should not be called at runtime.

    ValidateRecording ¶
    C · b2ValidateRecordingSource · box2d.odin:480

    ValidateRecording :: proc "c" (data: rawptr, size: i32, workerCount: i32) -> bool ---
     

    Replay a recording by re-running the engine and asserting recorded ids and state match. @param data Recorded bytes. @param size Number of recorded bytes @param workerCount Worker count to use for replay. 0 uses the serial single-worker fallback. @return true if replay completed without divergence, false on any mismatch

    WeldJoint_GetAngularDampingRatio ¶
    C · b2WeldJoint_GetAngularDampingRatioSource · box2d.odin:1562

    WeldJoint_GetAngularDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the weld joint angular damping ratio, non-dimensional

    WeldJoint_GetAngularHertz ¶
    C · b2WeldJoint_GetAngularHertzSource · box2d.odin:1565

    WeldJoint_GetAngularHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the weld joint angular stiffness in Hertz

    WeldJoint_GetLinearDampingRatio ¶
    C · b2WeldJoint_GetLinearDampingRatioSource · box2d.odin:1568

    WeldJoint_GetLinearDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the weld joint linear damping ratio (non-dimensional)

    WeldJoint_GetLinearHertz ¶
    C · b2WeldJoint_GetLinearHertzSource · box2d.odin:1571

    WeldJoint_GetLinearHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the weld joint linear stiffness in Hertz

    WeldJoint_SetAngularDampingRatio ¶
    C · b2WeldJoint_SetAngularDampingRatioSource · box2d.odin:1574

    WeldJoint_SetAngularDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set weld joint angular damping ratio, non-dimensional

    WeldJoint_SetAngularHertz ¶
    C · b2WeldJoint_SetAngularHertzSource · box2d.odin:1577

    WeldJoint_SetAngularHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the weld joint angular stiffness in Hertz. 0 is rigid.

    WeldJoint_SetLinearDampingRatio ¶
    C · b2WeldJoint_SetLinearDampingRatioSource · box2d.odin:1580

    WeldJoint_SetLinearDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the weld joint linear damping ratio (non-dimensional)

    WeldJoint_SetLinearHertz ¶
    C · b2WeldJoint_SetLinearHertzSource · box2d.odin:1583

    WeldJoint_SetLinearHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the weld joint linear stiffness in Hertz. 0 is rigid.

    WheelJoint_EnableLimit ¶
    C · b2WheelJoint_EnableLimitSource · box2d.odin:1590

    WheelJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---
     

    Enable/disable the wheel joint limit

    WheelJoint_EnableMotor ¶
    C · b2WheelJoint_EnableMotorSource · box2d.odin:1593

    WheelJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---
     

    Enable/disable the wheel joint motor

    WheelJoint_EnableSpring ¶
    C · b2WheelJoint_EnableSpringSource · box2d.odin:1596

    WheelJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---
     

    Enable/disable the wheel joint spring

    WheelJoint_GetCurrentMotorTorque ¶
    C · b2WheelJoint_GetCurrentMotorTorqueSource · box2d.odin:1599

    WheelJoint_GetCurrentMotorTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint current motor torque, usually in newton-meters

    WheelJoint_GetLowerLimit ¶
    C · b2WheelJoint_GetLowerLimitSource · box2d.odin:1602

    WheelJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint lower limit

    WheelJoint_GetMaxMotorTorque ¶
    C · b2WheelJoint_GetMaxMotorTorqueSource · box2d.odin:1605

    WheelJoint_GetMaxMotorTorque :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint maximum motor torque, usually in newton-meters

    WheelJoint_GetSpringDampingRatio ¶
    C · b2WheelJoint_GetSpringDampingRatioSource · box2d.odin:1608

    WheelJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint damping ratio, non-dimensional

    WheelJoint_GetSpringHertz ¶
    C · b2WheelJoint_GetSpringHertzSource · box2d.odin:1611

    WheelJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint stiffness in Hertz

    WheelJoint_GetTargetMotorSpeed ¶
    C · b2WheelJoint_GetTargetMotorSpeedSource · box2d.odin:1614

    WheelJoint_GetTargetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint motor speed in radians per second

    WheelJoint_GetUpperLimit ¶
    C · b2WheelJoint_GetUpperLimitSource · box2d.odin:1617

    WheelJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the wheel joint upper limit

    WheelJoint_IsLimitEnabled ¶
    C · b2WheelJoint_IsLimitEnabledSource · box2d.odin:1620

    WheelJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the wheel joint limit enabled?

    WheelJoint_IsMotorEnabled ¶
    C · b2WheelJoint_IsMotorEnabledSource · box2d.odin:1623

    WheelJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the wheel joint motor enabled?

    WheelJoint_IsSpringEnabled ¶
    C · b2WheelJoint_IsSpringEnabledSource · box2d.odin:1626

    WheelJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---
     

    Is the wheel joint spring enabled?

    WheelJoint_SetLimits ¶
    C · b2WheelJoint_SetLimitsSource · box2d.odin:1629

    WheelJoint_SetLimits :: proc "c" (jointId: JointId, lower: f32, upper: f32) ---
     

    Set the wheel joint limits

    WheelJoint_SetMaxMotorTorque ¶
    C · b2WheelJoint_SetMaxMotorTorqueSource · box2d.odin:1632

    WheelJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---
     

    Set the wheel joint maximum motor torque, usually in newton-meters

    WheelJoint_SetSpringDampingRatio ¶
    C · b2WheelJoint_SetSpringDampingRatioSource · box2d.odin:1635

    WheelJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---
     

    Set the wheel joint damping ratio, non-dimensional

    WheelJoint_SetSpringHertz ¶
    C · b2WheelJoint_SetSpringHertzSource · box2d.odin:1638

    WheelJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---
     

    Set the wheel joint stiffness in Hertz

    WheelJoint_SetTargetMotorSpeed ¶
    C · b2WheelJoint_SetTargetMotorSpeedSource · box2d.odin:1641

    WheelJoint_SetTargetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---
     

    Set the wheel joint motor speed in radians per second

    World_CastMover ¶
    C · b2World_CastMoverSource · box2d.odin:1650

    World_CastMover :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	#by_ptr mover: Capsule, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    ) -> f32 ---
     

    Cast a capsule mover through the world. This is a special shape cast that handles sliding along other shapes while reducing clipping. The mover capsule is relative to the origin. Near the origin pass b2Pos_zero and a world capsule. Returns the translation fraction at the first hit.

    World_CastRay ¶
    C · b2World_CastRaySource · box2d.odin:1662

    World_CastRay :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    	fcn:         CastResultCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Cast a ray into the world to collect shapes in the path of the ray. Your callback function controls whether you get the closest point, any point, or n-points. @note The callback function may receive shapes in any order @param worldId The world to cast the ray against @param origin The start point of the ray @param translation The translation of the ray from the start point to the end point @param filter Contains bit flags to filter unwanted shapes from the results @param fcn A user implemented callback function @param context A user context that is passed along to the callback function @return traversal performance counters

    World_CastRayClosest ¶
    C · b2World_CastRayClosestSource · box2d.odin:1667

    World_CastRayClosest :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    ) -> RayResult ---
     

    Cast a ray into the world to collect the closest hit. This is a convenience function. Ignores initial overlap. This is less general than b2World_CastRay() and does not allow for custom filtering.

    World_CastShape ¶
    C · b2World_CastShapeSource · box2d.odin:1672

    World_CastShape :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	#by_ptr proxy: ShapeProxy, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    	fcn:         CastResultCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Cast a shape through the world. Similar to a ray cast except that a shape is cast instead of a point. The proxy points are relative to the origin. Callback points are world positions. @see b2World_CastRay

    World_CollideMover ¶
    C · b2World_CollideMoverSource · box2d.odin:1677

    World_CollideMover :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	#by_ptr mover: Capsule, 
    	filter:      QueryFilter, 
    	fcn:         PlaneResultCallbackFcn, 
    	userContext: rawptr, 
    ) ---
     

    Collide a capsule mover with the world, gathering collision planes that can be fed to b2SolvePlanes. Useful for kinematic character movement. The mover capsule and the resulting planes are relative to the origin.

    World_Draw ¶
    C · b2World_DrawSource · box2d.odin:1680

    World_Draw :: proc "c" (worldId: WorldId, draw: ^DebugDraw) ---
     

    Call this to draw shapes and other debug draw data

    World_DumpMemoryStats ¶
    C · b2World_DumpMemoryStatsSource · box2d.odin:1683

    World_DumpMemoryStats :: proc "c" (worldId: WorldId) ---
     

    Dump memory stats to box2d_memory.txt

    World_EnableContinuous ¶
    C · b2World_EnableContinuousSource · box2d.odin:1689

    World_EnableContinuous :: proc "c" (worldId: WorldId, flag: bool) ---
     

    Enable/disable continuous collision between dynamic and static bodies. Generally you should keep continuous collision enabled to prevent fast moving objects from going through static objects. The performance gain from disabling continuous collision is minor. @see b2WorldDef

    World_EnableRestitutionPropagation ¶
    C · b2World_EnableRestitutionPropagationSource · box2d.odin:1693

    World_EnableRestitutionPropagation :: proc "c" (worldId: WorldId, flag: bool) ---
     

    Enable/disable restitution propagation. @see b2WorldDef::enableRestitutionPropagation

    World_EnableSSE2Fallback ¶
    C · b2World_EnableSSE2FallbackSource · box2d.odin:1696

    World_EnableSSE2Fallback :: proc "c" (worldId: WorldId, flag: bool) ---
     

    Force SSE2 to be used even when AVX2 is available. This is for testing.

    World_EnableSleeping ¶
    C · b2World_EnableSleepingSource · box2d.odin:1701

    World_EnableSleeping :: proc "c" (worldId: WorldId, flag: bool) ---
     

    Enable/disable sleep. If your application does not need sleeping, you can gain some performance by disabling sleep completely at the world level. @see b2WorldDef

    World_EnableWarmStarting ¶
    C · b2World_EnableWarmStartingSource · box2d.odin:1705

    World_EnableWarmStarting :: proc "c" (worldId: WorldId, flag: bool) ---
     

    Enable/disable constraint warm starting. Advanced feature for testing. Disabling warm starting greatly reduces stability and provides no performance gain.

    World_Explode ¶
    C · b2World_ExplodeSource · box2d.odin:1710

    World_Explode :: proc "c" (worldId: WorldId, #by_ptr explosionDef: ExplosionDef) ---
     

    Apply a radial explosion @param worldId The world id @param explosionDef The explosion definition

    World_GetAwakeBodyCount ¶
    C · b2World_GetAwakeBodyCountSource · box2d.odin:1713

    World_GetAwakeBodyCount :: proc "c" (worldId: WorldId) -> i32 ---
     

    Get the number of awake bodies.

    World_GetBodyEvents ¶
    C · b2World_GetBodyEventsSource · box2d.odin:1717

    World_GetBodyEvents :: proc "c" (worldId: WorldId) -> BodyEvents ---
     

    Get the body events for the current time step. The event data is transient. Do not store a reference to this data.

    World_GetBounds ¶
    C · b2World_GetBoundsSource · box2d.odin:1720

    World_GetBounds :: proc "c" (worldId: WorldId) -> AABB ---
     

    Call this to get the world bounds based on the union of all shape bounds.

    World_GetContactEvents ¶
    C · b2World_GetContactEventsSource · box2d.odin:1724

    World_GetContactEvents :: proc "c" (worldId: WorldId) -> ContactEvents ---
     

    Get contact events for the current time step. The event data is transient. Do not store a reference to this data.

    World_GetContactRecycleDistance ¶
    C · b2World_GetContactRecycleDistanceSource · box2d.odin:1727

    World_GetContactRecycleDistance :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the contact point recycling distance. Usually in meters.

    World_GetContactTuning ¶
    C · b2World_GetContactTuningSource · box2d.odin:1730

    World_GetContactTuning :: proc "c" (
    	worldId:      WorldId, 
    	hertz:        ^f32, 
    	dampingRatio: ^f32, 
    	pushSpeed:    ^f32, 
    ) ---
     

    Get the contact tuning.

    World_GetCounters ¶
    C · b2World_GetCountersSource · box2d.odin:1733

    World_GetCounters :: proc "c" (worldId: WorldId) -> Counters ---
     

    Get world counters and sizes

    World_GetGravity ¶
    C · b2World_GetGravitySource · box2d.odin:1736

    World_GetGravity :: proc "c" (worldId: WorldId) -> [2]f32 ---
     

    Get the gravity vector

    World_GetHitEventThreshold ¶
    C · b2World_GetHitEventThresholdSource · box2d.odin:1739

    World_GetHitEventThreshold :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the hit event speed threshold. Usually in meters per second.

    World_GetJointEvents ¶
    C · b2World_GetJointEventsSource · box2d.odin:1743

    World_GetJointEvents :: proc "c" (worldId: WorldId) -> JointEvents ---
     

    Get the joint events for the current time step. The event data is transient. Do not store a reference to this data.

    World_GetMaxCapacity ¶
    C · b2World_GetMaxCapacitySource · box2d.odin:1746

    World_GetMaxCapacity :: proc "c" (worldId: WorldId) -> Capacity ---
     

    Get max capacity. This can be used with b2WorldDef to avoid run-time allocations and copies

    World_GetMaxLinearSpeed ¶
    C · b2World_GetMaxLinearSpeedSource · box2d.odin:1749

    World_GetMaxLinearSpeed :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the maximum linear speed. Usually in m/s.

    World_GetProfile ¶
    C · b2World_GetProfileSource · box2d.odin:1752

    World_GetProfile :: proc "c" (worldId: WorldId) -> Profile ---
     

    Get the current world performance profile

    World_GetRestitutionIterations ¶
    C · b2World_GetRestitutionIterationsSource · box2d.odin:1755

    World_GetRestitutionIterations :: proc "c" (worldId: WorldId) -> i32 ---
     

    Get the number of iterations used by the restitution solver.

    World_GetRestitutionThreshold ¶
    C · b2World_GetRestitutionThresholdSource · box2d.odin:1758

    World_GetRestitutionThreshold :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the restitution speed threshold. Usually in meters per second.

    World_GetSensorEvents ¶
    C · b2World_GetSensorEventsSource · box2d.odin:1762

    World_GetSensorEvents :: proc "c" (worldId: WorldId) -> SensorEvents ---
     

    Get sensor events for the current time step. The event data is transient. Do not store a reference to this data.

    World_GetSnapshot ¶
    C · b2World_GetSnapshotSource · box2d.odin:1772

    World_GetSnapshot :: proc "c" (worldId: WorldId, image: [^]u8, capacity: i32) -> i32 ---
     

    Write a snapshot of the world's simulation state into a caller-owned buffer. Call once with image == NULL to get the required size, then again with a buffer of at least that size. Must be called at a step boundary. @param worldId The world to snapshot @param image Destination buffer, or NULL to query the size @param capacity Size of image in bytes, ignored when querying @return The number of bytes the snapshot needs. If it exceeds capacity nothing is written. Returns 0 if the world is mid-step.

    World_GetStateHash ¶
    C · b2World_GetStateHashSource · box2d.odin:1776

    World_GetStateHash :: proc "c" (worldId: WorldId) -> u64 ---
     

    Compute a hash of the simulation state. Use this to detect desyncs, for example in rollback resimulation.

    World_GetUserData ¶
    C · b2World_GetUserDataSource · box2d.odin:1779

    World_GetUserData :: proc "c" (worldId: WorldId) -> rawptr ---
     

    Get the user data pointer.

    World_GetWorkerCount ¶
    C · b2World_GetWorkerCountSource · box2d.odin:1782

    World_GetWorkerCount :: proc "c" (worldId: WorldId) -> i32 ---
     

    Get the worker count.

    World_IsContinuousEnabled ¶
    C · b2World_IsContinuousEnabledSource · box2d.odin:1785

    World_IsContinuousEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is continuous collision enabled?

    World_IsRestitutionPropagationEnabled ¶
    C · b2World_IsRestitutionPropagationEnabledSource · box2d.odin:1788

    World_IsRestitutionPropagationEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is restitution propagation enabled?

    World_IsSleepingEnabled ¶
    C · b2World_IsSleepingEnabledSource · box2d.odin:1791

    World_IsSleepingEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is body sleeping enabled?

    World_IsValid ¶
    C · b2World_IsValidSource · box2d.odin:1794

    World_IsValid :: proc "c" (id: WorldId) -> bool ---
     

    World id validation. Provides validation for up to 64K allocations.

    World_IsWarmStartingEnabled ¶
    C · b2World_IsWarmStartingEnabledSource · box2d.odin:1797

    World_IsWarmStartingEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is constraint warm starting enabled?

    World_OverlapAABB ¶
    C · b2World_OverlapAABBSource · box2d.odin:1802

    World_OverlapAABB :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	aabb:        AABB, 
    	filter:      QueryFilter, 
    	fcn:         OverlapResultCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Overlap test for all shapes that potentially overlap the provided AABB. The AABB is relative to the origin, which keeps the test precise far from the world origin in large world mode. Near the origin pass b2Pos_zero and a world AABB.

    World_OverlapShape ¶
    C · b2World_OverlapShapeSource · box2d.odin:1806

    World_OverlapShape :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	#by_ptr proxy: ShapeProxy, 
    	filter:      QueryFilter, 
    	fcn:         OverlapResultCallbackFcn, 
    	userContext: rawptr, 
    ) -> TreeStats ---
     

    Overlap test for all shapes that overlap the provided shape proxy. The proxy points are relative to the origin. Near the origin pass b2Pos_zero and world points.

    World_RebuildStaticTree ¶
    C · b2World_RebuildStaticTreeSource · box2d.odin:1809

    World_RebuildStaticTree :: proc "c" (worldId: WorldId) ---
     

    This is for internal testing

    World_RestoreFromSnapshot ¶
    C · b2World_RestoreFromSnapshotSource · box2d.odin:1820

    World_RestoreFromSnapshot :: proc "c" (worldId: WorldId, image: [^]u8, size: i32) -> bool ---
     

    Restore a world's simulation state from a snapshot image. The b2WorldId and ids held from this same world stay valid for objects that existed at the snapshot instant. Callbacks and threading configuration are preserved. User data on shapes, bodies, and joints is nulled. @param worldId The world to restore into @param image A snapshot image produced by b2World_GetSnapshot @param size Size of image in bytes @return true on success. On a rejected image (bad magic, version, or layout) the world is left unchanged. A corrupt payload detected after the rebuild begins returns false and leaves the world unusable, so the caller must destroy it.

    World_SetContactRecycleDistance ¶
    C · b2World_SetContactRecycleDistanceSource · box2d.odin:1824

    World_SetContactRecycleDistance :: proc "c" (worldId: WorldId, recycleDistance: f32) ---
     

    Set the contact point recycling distance. Setting this to zero disables contact point recycling. Usually in meters.

    World_SetContactTuning ¶
    C · b2World_SetContactTuningSource · box2d.odin:1832

    World_SetContactTuning :: proc "c" (
    	worldId:      WorldId, 
    	hertz:        f32, 
    	dampingRatio: f32, 
    	pushSpeed:    f32, 
    ) ---
     

    Adjust contact tuning parameters @param worldId The world id @param hertz The contact stiffness (cycles per second) @param dampingRatio The contact bounciness with 1 being critical damping (non-dimensional) @param pushSpeed The maximum contact constraint push out speed (meters per second) @note Advanced feature

    World_SetCustomFilterCallback ¶
    C · b2World_SetCustomFilterCallbackSource · box2d.odin:1835

    World_SetCustomFilterCallback :: proc "c" (
    	worldId:     WorldId, 
    	fcn:         CustomFilterCallbackFcn, 
    	userContext: rawptr, 
    ) ---
     

    Register the custom filter callback. This is optional.

    World_SetFrictionCallback ¶
    C · b2World_SetFrictionCallbackSource · box2d.odin:1838

    World_SetFrictionCallback :: proc "c" (worldId: WorldId, callback: FrictionCallbackFcn) ---
     

    Set the friction callback. Passing NULL resets to default.

    World_SetGravity ¶
    C · b2World_SetGravitySource · box2d.odin:1843

    World_SetGravity :: proc "c" (worldId: WorldId, gravity: [2]f32) ---
     

    Set the gravity vector for the entire world. Box2D has no concept of an up direction and this is left as a decision for the application. Usually in m/s^2. @see b2WorldDef

    World_SetHitEventThreshold ¶
    C · b2World_SetHitEventThresholdSource · box2d.odin:1848

    World_SetHitEventThreshold :: proc "c" (worldId: WorldId, value: f32) ---
     

    Adjust the hit event threshold. This controls the collision speed needed to generate a b2ContactHitEvent. Usually in meters per second. @see b2WorldDef::hitEventThreshold

    World_SetMaxLinearSpeed ¶
    C · b2World_SetMaxLinearSpeedSource · box2d.odin:1851

    World_SetMaxLinearSpeed :: proc "c" (worldId: WorldId, maximumLinearSpeed: f32) ---
     

    Set the maximum linear speed. Usually in m/s.

    World_SetPreSolveCallback ¶
    C · b2World_SetPreSolveCallbackSource · box2d.odin:1854

    World_SetPreSolveCallback :: proc "c" (
    	worldId:          WorldId, 
    	preSolveFcn:      PreSolveCallbackFcn, 
    	preContinuousFcn: PreContinuousCallbackFcn, 
    	userContext:      rawptr, 
    ) ---
     

    Register the pre-solve and pre-continuous callbacks. This is optional.

    World_SetRestitutionCallback ¶
    C · b2World_SetRestitutionCallbackSource · box2d.odin:1857

    World_SetRestitutionCallback :: proc "c" (worldId: WorldId, callback: RestitutionCallbackFcn) ---
     

    Set the restitution callback. Passing NULL resets to default.

    World_SetRestitutionIterations ¶
    C · b2World_SetRestitutionIterationsSource · box2d.odin:1861

    World_SetRestitutionIterations :: proc "c" (worldId: WorldId, iterations: i32) ---
     

    Set the number of iterations used by the restitution solver. @see B2_MAX_RESTITUTION_ITERATIONS

    World_SetRestitutionThreshold ¶
    C · b2World_SetRestitutionThresholdSource · box2d.odin:1866

    World_SetRestitutionThreshold :: proc "c" (worldId: WorldId, value: f32) ---
     

    Adjust the restitution threshold. It is recommended not to make this value very small because it will prevent bodies from sleeping. Usually in meters per second. @see b2WorldDef

    World_SetUserData ¶
    C · b2World_SetUserDataSource · box2d.odin:1869

    World_SetUserData :: proc "c" (worldId: WorldId, userData: rawptr) ---
     

    Set the user data pointer.

    World_SetWorkerCount ¶
    C · b2World_SetWorkerCountSource · box2d.odin:1872

    World_SetWorkerCount :: proc "c" (worldId: WorldId, count: i32) ---
     

    Set the worker count. Must be in the range [1, B2_MAX_WORKERS]

    World_StartRecording ¶
    C · b2World_StartRecordingSource · box2d.odin:1880

    World_StartRecording :: proc "c" (worldId: WorldId, recording: ^Recording) ---
     

    Begin recording the world into @p recording. Serializes a snapshot of the current world as the seed, then logs every mutating call. Call at a step boundary, before or after creating bodies. Start before the first step to capture the whole session. No effect if already recording or if the world is locked. @param worldId The world to record @param recording A recording buffer from b2CreateRecording

    World_Step ¶
    C · b2World_StepSource · box2d.odin:1888

    World_Step :: proc "c" (worldId: WorldId, timeStep: f32, subStepCount: i32) ---
     

    Simulate a world for one time step. This performs collision detection, integration, and constraint solution. @param worldId The world to simulate @param timeStep The amount of time to simulate, this should be a fixed number. Usually 1/60. @param subStepCount The number of sub-steps, increasing the sub-step count can increase accuracy. Usually 4.

    External examples raylib/box2d

    World_StopRecording ¶
    C · b2World_StopRecordingSource · box2d.odin:1892

    World_StopRecording :: proc "c" (worldId: WorldId) ---
     

    Stop recording. The recording buffer keeps its bytes. Save and destroy it yourself. @param worldId The world being recorded

    Yield ¶

    Yield :: proc "c" () ---
     

    Yield to be used in a busy loop.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-02 00:06:06.977463700 +0000 UTC