package vendor:box2d

⌘K
Ctrl+K
or
/

    Index

    Types (92)
    Variables (0)

    This section is empty.

    Procedures (473)
    Procedure Groups (1)

    Types

    AllocFcn ¶

    AllocFcn :: proc "c" (size: u32, 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
    
    Related Procedures With Parameters

    AssertFcn ¶

    AssertFcn :: proc "c" (condition, file_name: cstring, line_number: i32) -> i32
     

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

    Related Procedures With Parameters

    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 f32ing.
    	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 use 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,
    	// Optional body name for debugging. Up to 32 characters (excluding null termination)
    	name:              cstring,
    	// Use this to store application specific body data.
    	userData:          rawptr,
    	// Set this flag to false if this body should never fall asleep.
    	enableSleep:       bool,
    	// Is this body initially awake or sleeping?
    	isAwake:           bool,
    	// Should this body be prevented from rotating? Useful for characters.
    	fixedRotation:     bool,
    	// Treat this body as 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 may interfere with joint constraints.
    	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,
    	// 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(). @ingroup body

    Related Procedures With Parameters
    Related Procedures With Returns

    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 date becomes invalid if bodies are destroyed
    
    Related Procedures With Returns

    BodyId ¶

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

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

    Related Procedures With Parameters
    Related Procedures With Returns
    Related Constants

    BodyMoveEvent ¶

    BodyMoveEvent :: struct {
    	transform:  Transform,
    	bodyId:     BodyId,
    	userData:   rawptr,
    	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, 
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns

    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
    Related Procedures With Returns

    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

    Related Procedures With Returns

    CastResultFcn ¶

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

    Prototype callback for ray casts. Called for each shape found in the query. You control how the ray cast proceeds by returning a f32: 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 @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 @param fraction the fraction along the ray at the point of intersection

    @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

    @ingroup world
    
    Related Procedures With Parameters

    ChainDef ¶

    ChainDef :: struct {
    	// Use this to store application specific shape data.
    	userData:           rawptr,
    	// An array of at least 4 points. These are cloned and may be temporary.
    	points:             [^][2]f32 `fmt:"v,count"`,
    	// The point count, must be 4 or more.
    	count:              i32,
    	// Surface materials for each segment. These are cloned.
    	materials:          [^]SurfaceMaterial `fmt:"v,materialCount"`,
    	// The material count. Must be 1 or count. This allows you to provide one
    	// material for all segments or a unique material per segment.
    	materialCount:      i32,
    	// Contact filtering data.
    	filter:             Filter,
    	// Indicates a closed chain formed by connecting the first and last points
    	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
    

    a chain must have at least 4 points

    - 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 has NO COLLISION on the first and final edge
    - you may overlap two open chains on their first three and/or last three 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.
    

    @ingroup shape

    Related Procedures With Parameters
    Related Procedures With Returns

    ChainId ¶

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

    / Chain id references a chain instances. 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
    Related Procedures With Returns

    Circle ¶

    Circle :: struct {
    	// The local center
    	center: [2]f32,
    	// The radius
    	radius: f32,
    }
     

    A solid circle

    Related Procedures With Parameters
    Related Procedures With Returns

    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 initial contact manifold. This is recorded before the solver is called,
    	// so all the impulses will be zero.
    	manifold: Manifold,
    }
     

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

    ContactData ¶

    ContactData :: struct {
    	// Id of the first shape
    	shapeIdA: ShapeId,
    	// Id of the second shape
    	shapeIdB: ShapeId,
    	// The initial contact manifold. This is recorded before the solver is called,
    	// so all the impulses will be zero.
    	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
    	// @warning this shape may have been destroyed
    	// @see b2Shape_IsValid
    	shapeIdA: ShapeId,
    	// Id of the second shape
    	// @warning this shape may have been destroyed
    	// @see b2Shape_IsValid
    	shapeIdB: ShapeId,
    }
     

    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
    
    Related Procedures With Returns

    ContactHitEvent ¶

    ContactHitEvent :: struct {
    	// Id of the first shape
    	shapeIdA:      ShapeId,
    	// Id of the second shape
    	shapeIdB:      ShapeId,
    	// Point where the shapes hit
    	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 touch event is generated when two shapes collide with a speed faster than the hit speed threshold.

    CosSin ¶

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

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

    Related Procedures With Returns

    Counters ¶

    Counters :: struct {
    	bodyCount:        i32,
    	shapeCount:       i32,
    	contactCount:     i32,
    	jointCount:       i32,
    	islandCount:      i32,
    	stackUsed:        i32,
    	staticTreeHeight: i32,
    	treeHeight:       i32,
    	byteCount:        i32,
    	taskCount:        i32,
    	colorCounts:      [12]i32,
    }
     

    Counters that give details of the simulation size.

    Related Procedures With Returns

    CustomFilterFcn ¶

    CustomFilterFcn :: proc "c" (shapeIdA, shapeIdB: ShapeId, ctx: 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. @see b2ShapeDef.
    

    Notes:

    - this function must be thread-safe
    - this is only called if one of the two shapes has enabled custom filtering
    

    this is called only for awake dynamic bodies

    Return false if you want to disable the collision
    @warning Do not attempt to modify the world inside this callback
    @ingroup world
    
    Related Procedures With Parameters

    DebugDraw ¶

    DebugDraw :: struct {
    	// Draw a closed polygon provided in CCW order.
    	DrawPolygonFcn:       proc "c" (vertices: [^][2]f32, vertexCount: i32, color: HexColor, ctx: rawptr),
    	// Draw a solid closed polygon provided in CCW order.
    	DrawSolidPolygonFcn:  proc "c" (transform: Transform, vertices: [^][2]f32, vertexCount: i32, radius: f32, colr: HexColor, ctx: rawptr),
    	// Draw a circle.
    	DrawCircleFcn:        proc "c" (center: [2]f32, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a solid circle.
    	DrawSolidCircleFcn:   proc "c" (transform: Transform, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a solid capsule.
    	DrawSolidCapsuleFcn:  proc "c" (p1, p2: [2]f32, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a line segment.
    	DrawSegmentFcn:       proc "c" (p1, p2: [2]f32, color: HexColor, ctx: rawptr),
    	// Draw a transform. Choose your own length scale.
    	DrawTransformFcn:     proc "c" (transform: Transform, ctx: rawptr),
    	// Draw a point.
    	DrawPointFcn:         proc "c" (p: [2]f32, size: f32, color: HexColor, ctx: rawptr),
    	// Draw a string in world space.
    	DrawStringFcn:        proc "c" (p: [2]f32, s: cstring, color: HexColor, ctx: rawptr),
    	// Bounds to use if restricting drawing to a rectangular region
    	drawingBounds:        AABB,
    	// Option to restrict drawing to a rectangular region. May suffer from unstable depth sorting.
    	useDrawingBounds:     bool,
    	// Option to draw shapes
    	drawShapes:           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 draw contact points
    	drawContacts:         bool,
    	// Option to visualize the graph coloring used for contacts and joints
    	drawGraphColors:      bool,
    	// Option to draw contact normals
    	drawContactNormals:   bool,
    	// Option to draw contact normal impulses
    	drawContactImpulses:  bool,
    	// Option to draw contact feature ids
    	drawContactFeatures:  bool,
    	// Option to draw contact friction impulses
    	drawFrictionImpulses: 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.

    @ingroup world
    
    Related Procedures With Parameters
    Related Procedures With Returns

    DistanceInput ¶

    DistanceInput :: struct {
    	// The proxy for shape A
    	proxyA:     ShapeProxy,
    	// The proxy for shape B
    	proxyB:     ShapeProxy,
    	// The world transform for shape A
    	transformA: Transform,
    	// The world transform for shape B
    	transformB: Transform,
    	// Should the proxy radius be considered?
    	useRadii:   bool,
    }
     

    Input for b2ShapeDistance

    Related Procedures With Parameters

    DistanceJointDef ¶

    DistanceJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// 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 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. Clamped to a stable minimum value.
    	minLength:        f32,
    	// Maximum length. 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,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Distance joint definition

    This requires defining an anchor point on both bodies and the non-zero distance of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. @ingroup distance_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    DistanceOutput ¶

    DistanceOutput :: struct {
    	pointA:       [2]f32,
    	// Closest point on shapeA
    	pointB:       [2]f32,
    	// Closest point on shapeB
    	normal:       [2]f32,
    	// Normal vector that points from A to B
    	distance:     f32,
    	// The final distance, zero if overlapped
    	iterations:   i32,
    	// Number of GJK iterations used
    	simplexCount: i32,
    }
     

    Output for b2ShapeDistance

    Related Procedures With Returns

    DynamicTree ¶

    DynamicTree :: struct {
    	// The tree nodes
    	nodes:           rawptr,
    	// The root index
    	root:            i32,
    	// The number of nodes
    	nodeCount:       i32,
    	// The allocated node space
    	nodeCapacity:    i32,
    	// Node free list
    	freeList:        i32,
    	// Number of proxies created
    	proxyCount:      i32,
    	// Leaf indices for rebuild
    	leafIndices:     [^]i32,
    	// Leaf bounding boxes for rebuild
    	leafBoxes:       [^]AABB,
    	// Leaf bounding box centers for rebuild
    	leafCenters:     [^][2]f32,
    	// Bins for sorting during rebuild
    	binIndices:      [^]i32,
    	// Allocated space for rebuilding
    	rebuildCapacity: i32,
    }
     

    The dynamic tree structure. This should be considered private data. It is placed here for performance reasons.

    Related Procedures With Parameters
    Related Procedures With Returns

    EnqueueTaskCallback ¶

    EnqueueTaskCallback :: proc "c" (task: TaskCallback, itemCount: i32, minRange: i32, taskContext: rawptr, userContext: rawptr) -> rawptr
     

    These functions can be provided to Box2D to invoke a task system. These are designed to work well with enkiTS. 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 b2FinishTaskCallback.
    The itemCount is the number of Box2D work items that are to be partitioned among workers by the user's task system.
    This is essentially a parallel-for. The minRange parameter is a suggestion of the minimum number of items to assign
    per worker to reduce overhead. For example, suppose the task is small and that itemCount is 16. A minRange of 8 suggests
    that your task system should split the work items among just two workers, even if you have more available.
    In general the range [startIndex, endIndex) send to TaskCallback should obey:
    endIndex - startIndex >= minRange
    The exception of course is when itemCount < minRange.
    @ingroup world
    

    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. @ingroup world

    Related Procedures With Parameters
    Related Procedures With Returns

    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{.odin}
    	// 	My_Categories :: enum u64 {
    	// 		Static  = 0x00000001,
    	// 		Dynamic = 0x00000002,
    	// 		Debris  = 0x00000004,
    	// 		Player  = 0x00000008,
    	// 		// etc
    	// 	};
    	// 	@endcode
    	//      Or use a bit_set.
    	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{.odin}
    	// 	maskBits = u64(My_Categories.Static | My_Categories.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).
    

    @ingroup shape

    Related Procedures With Parameters
    Related Procedures With Returns

    FilterJointDef ¶

    FilterJointDef :: struct {
    	// / The first attached body.
    	bodyIdA:       BodyId,
    	// / The second attached body.
    	bodyIdB:       BodyId,
    	// / User data pointer
    	userData:      rawptr,
    	// / Used internally to detect a valid definition. DO NOT SET.
    	internalValue: i32,
    }
     

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

    @ingroup filter_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    FinishTaskCallback ¶

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

    Finishes a user task object that wraps a Box2D task.

    @ingroup world
    

    FreeFcn ¶

    FreeFcn :: proc "c" (mem: rawptr)
     

    Prototype for user free function

    @param mem the memory previously allocated through `b2AllocFcn`
    
    Related Procedures With Parameters

    FrictionCallback ¶

    FrictionCallback :: proc "c" (frictionA: f32, userMaterialIdA: i32, frictionB: f32, userMaterialIdB: i32)
     

    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. @ingroup world

    Related Procedures With Parameters

    HexColor ¶

    HexColor :: enum i32 {
    	AliceBlue            = 15792383, 
    	AntiqueWhite         = 16444375, 
    	Aqua                 = 65535, 
    	Aquamarine           = 8388564, 
    	Azure                = 15794175, 
    	Beige                = 16119260, 
    	Bisque               = 16770244, 
    	Black                = 0, 
    	BlanchedAlmond       = 16772045, 
    	Blue                 = 255, 
    	BlueViolet           = 9055202, 
    	Brown                = 10824234, 
    	Burlywood            = 14596231, 
    	CadetBlue            = 6266528, 
    	Chartreuse           = 8388352, 
    	Chocolate            = 13789470, 
    	Coral                = 16744272, 
    	CornflowerBlue       = 6591981, 
    	Cornsilk             = 16775388, 
    	Crimson              = 14423100, 
    	Cyan                 = 65535, 
    	DarkBlue             = 139, 
    	DarkCyan             = 35723, 
    	DarkGoldenRod        = 12092939, 
    	DarkGray             = 11119017, 
    	DarkGreen            = 25600, 
    	DarkKhaki            = 12433259, 
    	DarkMagenta          = 9109643, 
    	DarkOliveGreen       = 5597999, 
    	DarkOrange           = 16747520, 
    	DarkOrchid           = 10040012, 
    	DarkRed              = 9109504, 
    	DarkSalmon           = 15308410, 
    	DarkSeaGreen         = 9419919, 
    	DarkSlateBlue        = 4734347, 
    	DarkSlateGray        = 3100495, 
    	DarkTurquoise        = 52945, 
    	DarkViolet           = 9699539, 
    	DeepPink             = 16716947, 
    	DeepSkyBlue          = 49151, 
    	DimGray              = 6908265, 
    	DodgerBlue           = 2003199, 
    	FireBrick            = 11674146, 
    	FloralWhite          = 16775920, 
    	ForestGreen          = 2263842, 
    	Fuchsia              = 16711935, 
    	Gainsboro            = 14474460, 
    	GhostWhite           = 16316671, 
    	Gold                 = 16766720, 
    	GoldenRod            = 14329120, 
    	Gray                 = 8421504, 
    	Green                = 32768, 
    	GreenYellow          = 11403055, 
    	HoneyDew             = 15794160, 
    	HotPink              = 16738740, 
    	IndianRed            = 13458524, 
    	Indigo               = 4915330, 
    	Ivory                = 16777200, 
    	Khaki                = 15787660, 
    	Lavender             = 15132410, 
    	LavenderBlush        = 16773365, 
    	LawnGreen            = 8190976, 
    	LemonChiffon         = 16775885, 
    	LightBlue            = 11393254, 
    	LightCoral           = 15761536, 
    	LightCyan            = 14745599, 
    	LightGoldenRodYellow = 16448210, 
    	LightGray            = 13882323, 
    	LightGreen           = 9498256, 
    	LightPink            = 16758465, 
    	LightSalmon          = 16752762, 
    	LightSeaGreen        = 2142890, 
    	LightSkyBlue         = 8900346, 
    	LightSlateGray       = 7833753, 
    	LightSteelBlue       = 11584734, 
    	LightYellow          = 16777184, 
    	Lime                 = 65280, 
    	LimeGreen            = 3329330, 
    	Linen                = 16445670, 
    	Magenta              = 16711935, 
    	Maroon               = 8388608, 
    	MediumAquaMarine     = 6737322, 
    	MediumBlue           = 205, 
    	MediumOrchid         = 12211667, 
    	MediumPurple         = 9662683, 
    	MediumSeaGreen       = 3978097, 
    	MediumSlateBlue      = 8087790, 
    	MediumSpringGreen    = 64154, 
    	MediumTurquoise      = 4772300, 
    	MediumVioletRed      = 13047173, 
    	MidnightBlue         = 1644912, 
    	MintCream            = 16121850, 
    	MistyRose            = 16770273, 
    	Moccasin             = 16770229, 
    	NavajoWhite          = 16768685, 
    	Navy                 = 128, 
    	OldLace              = 16643558, 
    	Olive                = 8421376, 
    	OliveDrab            = 7048739, 
    	Orange               = 16753920, 
    	OrangeRed            = 16729344, 
    	Orchid               = 14315734, 
    	PaleGoldenRod        = 15657130, 
    	PaleGreen            = 10025880, 
    	PaleTurquoise        = 11529966, 
    	PaleVioletRed        = 14381203, 
    	PapayaWhip           = 16773077, 
    	PeachPuff            = 16767673, 
    	Peru                 = 13468991, 
    	Pink                 = 16761035, 
    	Plum                 = 14524637, 
    	PowderBlue           = 11591910, 
    	Purple               = 8388736, 
    	RebeccaPurple        = 6697881, 
    	Red                  = 16711680, 
    	RosyBrown            = 12357519, 
    	RoyalBlue            = 4286945, 
    	SaddleBrown          = 9127187, 
    	Salmon               = 16416882, 
    	SandyBrown           = 16032864, 
    	SeaGreen             = 3050327, 
    	SeaShell             = 16774638, 
    	Sienna               = 10506797, 
    	Silver               = 12632256, 
    	SkyBlue              = 8900331, 
    	SlateBlue            = 6970061, 
    	SlateGray            = 7372944, 
    	Snow                 = 16775930, 
    	SpringGreen          = 65407, 
    	SteelBlue            = 4620980, 
    	Tan                  = 13808780, 
    	Teal                 = 32896, 
    	Thistle              = 14204888, 
    	Tomato               = 16737095, 
    	Turquoise            = 4251856, 
    	Violet               = 15631086, 
    	Wheat                = 16113331, 
    	White                = 16777215, 
    	WhiteSmoke           = 16119285, 
    	Yellow               = 16776960, 
    	YellowGreen          = 10145074, 
    	Box2DRed             = 14430514, 
    	Box2DBlue            = 3190463, 
    	Box2DGreen           = 9226532, 
    	Box2DYellow          = 16772748, 
    }
     

    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
    Related Procedures With Returns

    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 Parameters
    Related Procedures With Returns
    Related Constants

    JointType ¶

    JointType :: enum i32 {
    	distanceJoint, 
    	filterJoint, 
    	motorJoint, 
    	mouseJoint, 
    	prismaticJoint, 
    	revoluteJoint, 
    	weldJoint, 
    	wheelJoint, 
    }
     

    Joint type enumeration

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

    Related Procedures With Returns

    Manifold ¶

    Manifold :: struct {
    	// The unit normal vector in world space, points from shape A to bodyB
    	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,
    	// The number of contacts 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.

    Related Procedures With Returns

    ManifoldPoint ¶

    ManifoldPoint :: struct {
    	// Location of the contact point in world space. Subject to precision loss at large coordinates.
    	// 	@note Should only be used for debugging.
    	point:              [2]f32,
    	// Location of the contact point relative to shapeA's origin in world space
    	// 	@note When used internally to the Box2D solver, this is relative to the body center of mass.
    	anchorA:            [2]f32,
    	// Location of the contact point relative to shapeB's origin in world space
    	// @note When used internally to the Box2D solver, this is relative to the body center of mass.
    	anchorB:            [2]f32,
    	// The separation of the contact point, negative if penetrating
    	separation:         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.
    	totalNormalImpulse: f32,
    	// The friction impulse
    	tangentImpulse:     f32,
    	// The maximum normal impulse applied during sub-stepping
    	// 	todo not sure this is needed
    	maxNormalImpulse:   f32,
    	// Relative normal velocity pre-solve. Used for hit events. If the normal impulse is
    	// zero then there was no hit. Negative means shapes are approaching.
    	normalVelocity:     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 local origin.
    	rotationalInertia: f32,
    }
     

    This holds the mass data computed for a shape.

    Related Procedures With Parameters
    Related Procedures With Returns

    Mat22 ¶

    Mat22 :: matrix[2, 2]f32
    Related Constants

    MotorJointDef ¶

    MotorJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// Position of bodyB minus the position of bodyA, in bodyA's frame
    	linearOffset:     [2]f32,
    	// The bodyB angle minus bodyA angle in radians
    	angularOffset:    f32,
    	// The maximum motor force in newtons
    	maxForce:         f32,
    	// The maximum motor torque in newton-meters
    	maxTorque:        f32,
    	// Position correction factor in the range [0,1]
    	correctionFactor: f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    A motor joint is used to control the relative motion between two bodies

    A typical usage is to control the movement of a dynamic body with respect to the ground. @ingroup motor_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    MouseJointDef ¶

    MouseJointDef :: struct {
    	// The first attached body. This is assumed to be static.
    	bodyIdA:          BodyId,
    	// The second attached body.
    	bodyIdB:          BodyId,
    	// The initial target point in world space
    	target:           [2]f32,
    	// Stiffness in hertz
    	hertz:            f32,
    	// Damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Maximum force, typically in newtons
    	maxForce:         f32,
    	// Set this flag to true if the attached bodies should collide.
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    A mouse joint is used to make a point on a body track a specified world point.

    This a soft constraint and allows the constraint to stretch without applying huge forces. This also applies rotation constraint heuristic to improve control. @ingroup mouse_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    OverlapResultFcn ¶

    OverlapResultFcn :: proc "c" (shapeId: ShapeId, ctx: rawptr) -> bool
     

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

    @ingroup world
    
    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 convex shape
    	plane: Plane,
    	// Did the collision register a hit? If not this plane should be ignored.
    	hit:   bool,
    }
     

    / These are the collision planes returned from b2World_CollideMover

    PlaneResultFcn ¶

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

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

    Related Procedures With Parameters

    PlaneSolverResult ¶

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

    Result returned by b2SolvePlanes

    Related Procedures With Returns

    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 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

    PreSolveFcn ¶

    PreSolveFcn :: proc "c" (shapeIdA, shapeIdB: ShapeId, manifold: ^Manifold, ctx: rawptr) -> bool
     

    Prototype for a pre-solve callback. This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. modify the normal). 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 has impulse values from the previous step

    Return false if you want to disable the contact this step
    @warning Do not attempt to modify the world inside this callback
    @ingroup world
    
    Related Procedures With Parameters

    PrismaticJointDef ¶

    PrismaticJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The local translation unit axis in bodyA
    	localAxisA:       [2]f32,
    	// The constrained angle between the bodies: bodyB_angle - bodyA_angle
    	referenceAngle:   f32,
    	// 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,
    	// 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,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Prismatic joint definition

    This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. @ingroup prismatic_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    Profile ¶

    Profile :: struct {
    	step:                f32,
    	pairs:               f32,
    	collide:             f32,
    	solve:               f32,
    	mergeIslands:        f32,
    	prepareStages:       f32,
    	solveConstraints:    f32,
    	prepareConstraints:  f32,
    	integrateVelocities: f32,
    	warmStart:           f32,
    	solveImpulses:       f32,
    	integratePositions:  f32,
    	relaxImpulses:       f32,
    	applyRestitution:    f32,
    	storeImpulses:       f32,
    	splitIslands:        f32,
    	transforms:          f32,
    	hitEvents:           f32,
    	refit:               f32,
    	bullets:             f32,
    	sleepIslands:        f32,
    	sensors:             f32,
    }
     

    ! @cond Profiling data. Times are in milliseconds.

    Related Procedures With Returns

    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.
    

    @ingroup shape

    Related Procedures With Parameters
    Related Procedures With Returns

    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 {
    	shapeId:    ShapeId,
    	point:      [2]f32,
    	normal:     [2]f32,
    	fraction:   f32,
    	nodeVisits: i32,
    	leafVisits: i32,
    	hit:        bool,
    }
     

    Result from b2World_RayCastClosest @ingroup world

    Related Procedures With Returns

    RestitutionCallback ¶

    RestitutionCallback :: proc "c" (restitutionA: f32, userMaterialIdA: i32, restitutuionB: f32, userMaterialIdB: i32)
     

    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. @ingroup world

    Related Procedures With Parameters

    RevoluteJointDef ¶

    RevoluteJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The bodyB angle minus bodyA angle in the reference state (radians).
    	// This defines the zero angle for the joint limit.
    	referenceAngle:   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.95*pi radians.
    	lowerAngle:       f32,
    	// The upper angle for the joint limit in radians. Maximum of 0.95*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,
    	// Scale the debug draw
    	drawSize:         f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Revolute joint definition

    This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points 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 @ingroup revolute_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    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
    Related Procedures With Returns

    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

    Related Procedures With Returns

    SensorBeginTouchEvent ¶

    SensorBeginTouchEvent :: struct {
    	// The id of the sensor shape
    	sensorShapeId:  ShapeId,
    	// The id of the dynamic 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 dynamic shape that began touching the sensor shape
    	visitorShapeId: ShapeId,
    }
     

    An end touch event is generated when a shape stops overlapping a sensor shape. These include things like setting the transform, destroying a body or shape, or changing a filter. You will also get an end event if the sensor or visitor are 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 Box2D 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
    
    Related Procedures With Returns

    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 wrap 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 {
    	proxyA:       ShapeProxy,
    	// The proxy for shape A
    	proxyB:       ShapeProxy,
    	// The proxy for shape B
    	transformA:   Transform,
    	// The world transform for shape A
    	transformB:   Transform,
    	// The world transform for shape B
    	translationB: [2]f32,
    	// The translation of shape B
    	maxFraction:  f32,
    	// The fraction of the translation to consider, typically 1
    	canEncroach:  bool,
    }
     

    Input parameters for b2ShapeCast

    Related Procedures With Parameters

    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,
    	// A sensor shape generates overlap events but never generates a collision response.
    	// Sensors do not have continuous collision. 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. False by default, even for sensors.
    	enableSensorEvents:    bool,
    	// Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.
    	enableContactEvents:   bool,
    	// Enable hit events for this shape. Only applies to kinematic and dynamic bodies. 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 threading. 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 is 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.
    	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(). @ingroup shape

    Related Procedures With Parameters
    Related Procedures With Returns

    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 MAX_POLYGON_VERTICES 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, 
    }
     

    Shape type @ingroup shape

    Related Procedures With Returns

    Simplex ¶

    Simplex :: struct {
    	v1:    SimplexVertex `fmt:"v,count"`,
    	v2:    SimplexVertex `fmt:"v,count"`,
    	v3:    SimplexVertex `fmt:"v,count"`,
    	// 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 this function multiple times with nearby transforms this might improve performance. Otherwise you can zero initialize this. The distance cache must be initialized to zero on the first call. Users should generally just zero initialize this structure for each call.

    Related Procedures With Parameters
    Related Constants

    SimplexVertex ¶

    SimplexVertex :: struct {
    	wA:     [2]f32,
    	// support point in proxyA
    	wB:     [2]f32,
    	// support point in proxyB
    	w:      [2]f32,
    	// wB - wA
    	a:      f32,
    	// barycentric coordinate for closest point
    	indexA: i32,
    	// wA 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:    i32,
    	// Custom debug draw color.
    	customColor:       u32,
    }
     

    Surface materials allow chain shapes to have per segment surface properties. @ingroup shape

    Related Procedures With Returns

    Sweep ¶

    Sweep :: struct {
    	localCenter: [2]f32,
    	// Local center of mass position
    	c1:          [2]f32,
    	// Starting center of mass world position
    	c2:          [2]f32,
    	// Ending center of mass world position
    	q1:          Rot,
    	// Starting 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.

    Related Procedures With Parameters

    TOIInput ¶

    TOIInput :: struct {
    	proxyA:      ShapeProxy,
    	// The proxy for shape A
    	proxyB:      ShapeProxy,
    	// The proxy for shape B
    	sweepA:      Sweep,
    	// The movement of shape A
    	sweepB:      Sweep,
    	// The movement of shape B
    	maxFraction: f32,
    }
     

    Input parameters for b2TimeOfImpact

    Related Procedures With Parameters

    TOIOutput ¶

    TOIOutput :: struct {
    	state:    TOIState,
    	// The type of result
    	fraction: f32,
    }
     

    Output parameters for b2TimeOfImpact.

    Related Procedures With Returns

    TOIState ¶

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

    Describes the TOI output

    TaskCallback ¶

    TaskCallback :: proc "c" (startIndex, endIndex: i32, workerIndex: u32, taskContext: rawptr)
     

    Task interface This is prototype for a Box2D task. Your task system is expected to invoke the Box2D task with these arguments. The task spans a range of the parallel-for: [startIndex, endIndex) The worker index must correctly identify each worker in the user thread pool, expected in [0, workerCount).

    A worker must only exist on only one thread at a time and is analogous to the thread index.
    

    The task context is the context pointer sent from Box2D when it is enqueued.

    The startIndex and endIndex are expected in the range [0, itemCount) where itemCount is the argument to b2EnqueueTaskCallback
    

    below. Box2D expects startIndex < endIndex and will execute a loop like this:

    @code{.odin}
    for i in startIndex ..< endIndex {
    	DoWork()
    }
    @endcode
    @ingroup world
    

    TreeQueryCallbackFcn ¶

    TreeQueryCallbackFcn :: proc "c" (proxyId: i32, userData: u64, ctx: 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" (#by_ptr input: RayCastInput, proxyId: i32, userData: u64, ctx: rawptr) -> f32
     

    This function receives clipped raycast 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

    Related Procedures With Parameters

    TreeShapeCastCallbackFcn ¶

    TreeShapeCastCallbackFcn :: proc "c" (#by_ptr input: ShapeCastInput, proxyId: i32, userData: u64, ctx: 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

    Related Procedures With Parameters

    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
    Related Constants

    Version ¶

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

    Version numbering scheme.

    See https://semver.org/

    WeldJointDef ¶

    WeldJointDef :: struct {
    	// The first attached body
    	bodyIdA:             BodyId,
    	// The second attached body
    	bodyIdB:             BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:        [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:        [2]f32,
    	// The bodyB angle minus bodyA angle in the reference state (radians)
    	referenceAngle:      f32,
    	// 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,
    	// Linear damping ratio, non-dimensional. Use 1 for critical damping.
    	angularDampingRatio: f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected:    bool,
    	// User data pointer
    	userData:            rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:       i32,
    }
     

    Weld joint definition

    A weld joint connect to bodies together rigidly. This constraint provides springs to mimic

    soft-body simulation.
    

    @note The approximate solver in Box2D cannot hold many bodies together rigidly @ingroup weld_joint

    Related Procedures With Parameters
    Related Procedures With Returns

    WheelJointDef ¶

    WheelJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The local translation unit axis in bodyA
    	localAxisA:       [2]f32,
    	// 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,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    Wheel joint definition

    This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. @ingroup wheel_joint

    Related Procedures With Parameters
    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,
    	// 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.
    	maxContactPushSpeed:  f32,
    	// Joint stiffness. Cycles per second.
    	jointHertz:           f32,
    	// Joint bounciness. Non-dimensional.
    	jointDampingRatio:    f32,
    	// Maximum linear speed. Usually meters per second.
    	maximumLinearSpeed:   f32,
    	// Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB).
    	frictionCallback:     FrictionCallback,
    	// Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB).
    	restitutionCallback:  RestitutionCallback,
    	// Can bodies go to sleep to improve performance
    	enableSleep:          bool,
    	// Enable continuous collision
    	enableContinuous:     bool,
    	// Number of workers to use with the provided task system. Box2D performs best when using only
    	// performance cores and accessing a single L2 cache. Efficiency cores and hyper-threading provide
    	// little benefit and may even harm performance.
    	// @note Box2D does not create threads. This is the number of threads your applications has created
    	// that you are allocating to b2World_Step.
    	// @warning Do not modify the default value unless you are also providing a task system and providing
    	// task callbacks (enqueueTask and finishTask).
    	workerCount:          i32,
    	// Function to spawn tasks
    	enqueueTask:          EnqueueTaskCallback,
    	// Function to finish a task
    	finishTask:           FinishTaskCallback,
    	// User context that is provided to enqueueTask and finishTask
    	userTaskContext:      rawptr,
    	// User data
    	userData:             rawptr,
    	// 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(). @ingroup world

    Related Procedures With Parameters
    Related Procedures With Returns

    Constants

    EPSILON ¶

    EPSILON: f64 : 1e-23

    HASH_INIT ¶

    HASH_INIT: int : 5381

    MAX_POLYGON_VERTICES ¶

    MAX_POLYGON_VERTICES: int : 8
     

    The maximum number of vertices on a convex polygon. Changing this affects performance even if you

    don't use more vertices.
    

    Mat22_zero ¶

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

    PI ¶

    PI: f64 : math.PI

    Rot_identity ¶

    Rot_identity :: Rot{1, 0}

    Transform_identity ¶

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

    Vec2_zero ¶

    Vec2_zero: [2]f32 : Vec2{0, 0}

    bodyTypeCount ¶

    bodyTypeCount: int : len(BodyType)
     

    number of body types

    emptySimplexCache ¶

    emptySimplexCache :: SimplexCache{}

    nullBodyId ¶

    nullBodyId :: BodyId{}

    nullChainId ¶

    nullChainId :: ChainId{}

    nullJointId ¶

    nullJointId :: JointId{}

    nullShapeId ¶

    nullShapeId :: ShapeId{}

    nullWorldId ¶

    nullWorldId :: WorldId{}
     

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

    shapeTypeCount ¶

    shapeTypeCount: int : len(ShapeType)
     

    The number of shape types

    Variables

    This section is empty.

    Procedures

    AABB_Center ¶

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

    Get the center of the AABB.

    AABB_Contains ¶

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

    Does a fully contain b

    AABB_Extents ¶

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

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

    AABB_Union ¶

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

    Union of two AABBs

    Abs ¶

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

    Component-wise absolute vector

    AbsFloat ¶

    AbsFloat :: proc "c" (a: f32) -> f32 {…}
     

    @return the absolute value of a float

    AbsInt ¶

    AbsInt :: proc "c" (a: i32) -> i32 {…}
     

    @return the absolute value of an integer

    Add ¶

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

    Vector addition

    Atan2 ¶

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

    Body_ApplyAngularImpulse ¶

    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 force,
    

    use a force instead, which will work better with the sub-stepping solver.

    Body_ApplyForce ¶

    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 ¶

    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 ¶

    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 ¶

    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_ApplyMassFromShapes ¶

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

    This update the mass properties to the sum of the mass properties of the shapes. This normally does not need to be called unless you called 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.
    

    Body_ApplyTorque ¶

    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_ComputeAABB ¶

    Body_ComputeAABB :: 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 ¶

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

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

    Body_Enable ¶

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

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

    Body_EnableContactEvents ¶

    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_EnableHitEvents ¶

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

    Enable/disable hit events on all shapes

    @see b2ShapeDef::enableHitEvents
    

    Body_EnableSleep ¶

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

    Enable or disable sleeping for this body. If sleeping is disabled the body will wake.

    Body_GetAngularDamping ¶

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

    Get the current angular damping.

    Body_GetAngularVelocity ¶

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

    Get the angular velocity of a body in radians per second

    Body_GetContactCapacity ¶

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

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

    Body_GetContactData ¶

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

    Get the touching contact data for a body

    Body_GetGravityScale ¶

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

    Get the current gravity scale

    Body_GetJointCount ¶

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

    Get the number of joints on this body

    Body_GetJoints ¶

    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 joint ids stored in the user array
    

    Body_GetLinearDamping ¶

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

    Get the current linear damping.

    Body_GetLinearVelocity ¶

    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_GetLocalCenterOfMass ¶

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

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

    Body_GetLocalPoint ¶

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

    Get a local point on a body given a world point

    Body_GetLocalPointVelocity ¶

    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 ¶

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

    Get a local vector on a body given a world vector

    Body_GetMass ¶

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

    Get the mass of the body, usually in kilograms

    Body_GetMassData ¶

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

    Get the mass data for a body

    Body_GetName ¶

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

    Get the body name. May be nil.

    Body_GetPosition ¶

    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 ¶

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

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

    Body_GetRotationalInertia ¶

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

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

    Body_GetShapeCount ¶

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

    Get the number of shapes on this body

    Body_GetShapes ¶

    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 shape ids stored in the user array
    

    Body_GetSleepThreshold ¶

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

    Get the sleep threshold, usually in meters per second.

    Body_GetTransform ¶

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

    Get the world transform of a body.

    Body_GetType ¶

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

    Get the body type: static, kinematic, or dynamic

    Body_GetUserData ¶

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

    Get the user data stored in a body

    Body_GetWorld ¶

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

    Get the world that owns this body

    Body_GetWorldCenterOfMass ¶

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

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

    Body_GetWorldPoint ¶

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

    Get a world point on a body given a local point

    Body_GetWorldVector ¶

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

    Get a world vector on a body given a local vector

    Body_IsAwake ¶

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

    @return true if this body is awake

    Body_IsBullet ¶

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

    Is this body a bullet?

    Body_IsEnabled ¶

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

    Returns true if this body is enabled

    Body_IsFixedRotation ¶

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

    Does this body have fixed rotation?

    Body_IsSleepEnabled ¶

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

    Returns true if sleeping is enabled for this body

    Body_IsValid ¶

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

    Body identifier validation. Can be used to detect orphaned ids. Provides validation for up to 64K allocations.

    Body_SetAngularDamping ¶

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

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

    Body_SetAngularVelocity ¶

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

    Set the angular velocity of a body in radians per second

    Body_SetAwake ¶

    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 ¶

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

    Set this body to be a bullet. A bullet does continuous collision detection against dynamic bodies (but not other bullets).

    Body_SetFixedRotation ¶

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

    Set this body to have fixed rotation. This causes the mass to be reset in all cases.

    Body_SetGravityScale ¶

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

    Adjust the gravity scale. Normally this is set in BodyDef before creation.

    @see BodyDef::gravityScale
    

    Body_SetLinearDamping ¶

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

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

    Body_SetLinearVelocity ¶

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

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

    Body_SetMassData ¶

    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.
    

    Body_SetName ¶

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

    Set the body name. Up to 32 characters excluding 0 termination.

    Body_SetSleepThreshold ¶

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

    Set the sleep threshold, usually in meters per second

    Body_SetTargetTransform ¶

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

    Set the velocity to reach the given transform after a given time step. The result will be close but maybe not exact. This is meant for kinematic bodies. This will automatically wake the body if asleep.

    Body_SetTransform ¶

    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 then intended transform.

    @see BodyDef::position and BodyDef::angle
    

    Body_SetType ¶

    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 ¶

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

    Set the user data for a body

    Chain_GetFriction ¶

    Chain_GetFriction :: proc "c" (chainId: ChainId) -> f32 ---
     

    Get the chain friction

    Chain_GetMaterial ¶

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

    Get the chain material

    Chain_GetRestitution ¶

    Chain_GetRestitution :: proc "c" (chainId: ChainId) -> f32 ---
     

    Get the chain restitution

    Chain_GetSegmentCount ¶

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

    Get the number of segments on this chain

    Chain_GetSegments ¶

    Chain_GetSegments :: proc "c" (chainId: ChainId, segmentArray: [^]ShapeId, capacity: i32) -> i32 ---
     

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

    Chain_GetWorld ¶

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

    Get the world that owns this chain shape

    Chain_IsValid ¶

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

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

    Chain_SetFriction ¶

    Chain_SetFriction :: proc "c" (chainId: ChainId, friction: f32) ---
     

    Set the chain friction @see b2ChainDef::friction

    Chain_SetMaterial ¶

    Chain_SetMaterial :: proc "c" (chainId: ChainId, material: i32) ---
     

    Set the chain material @see b2ChainDef::material

    Chain_SetRestitution ¶

    Chain_SetRestitution :: proc "c" (chainId: ChainId, restitution: f32) ---
     

    Set the chain restitution (bounciness) @see b2ChainDef::restitution

    Clamp ¶

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

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

    ClampFloat ¶

    ClampFloat :: proc "c" (a, lower, upper: f32) -> f32 {…}
     

    @return a f32 clamped between a lower and upper bound

    ClampInt ¶

    ClampInt :: proc "c" (a, lower, upper: i32) -> i32 {…}
     

    @return an integer clamped between a lower and upper bound

    ClipVector ¶

    ClipVector :: proc(vector: [2]f32, planes: []CollisionPlane) -> [2]f32 {…}

    CollideCapsuleAndCircle ¶

    CollideCapsuleAndCircle :: proc "c" (#by_ptr capsuleA: Capsule, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a capsule and circle

    CollideCapsules ¶

    CollideCapsules :: proc "c" (#by_ptr capsuleA: Capsule, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a capsule and circle

    CollideChainSegmentAndCapsule ¶

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

    Compute the contact manifold between an segment and a capsule

    CollideChainSegmentAndCircle ¶

    CollideChainSegmentAndCircle :: proc "c" (#by_ptr segmentA: ChainSegment, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a chain segment and a circle

    CollideChainSegmentAndPolygon ¶

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

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

    CollideCircles ¶

    CollideCircles :: proc "c" (#by_ptr circleA: Circle, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between two circles

    CollidePolygonAndCapsule ¶

    CollidePolygonAndCapsule :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a polygon and capsule

    CollidePolygonAndCircle ¶

    CollidePolygonAndCircle :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a polygon and a circle

    CollidePolygons ¶

    CollidePolygons :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr polygonB: Polygon, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between two polygons

    CollideSegmentAndCapsule ¶

    CollideSegmentAndCapsule :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a capsule

    CollideSegmentAndCircle ¶

    CollideSegmentAndCircle :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a circle

    CollideSegmentAndPolygon ¶

    CollideSegmentAndPolygon :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr polygonB: Polygon, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a polygon

    ComputeAngularVelocity ¶

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

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

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

    ComputeCapsuleAABB ¶

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

    Compute the bounding box of a transformed capsule

    ComputeCapsuleMass ¶

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

    Compute mass properties of a capsule

    ComputeCircleAABB ¶

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

    Compute the bounding box of a transformed circle

    ComputeCircleMass ¶

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

    Compute mass properties of a circle

    ComputeCosSin ¶

    ComputeCosSin :: proc "c" (radians: f32) -> (res: CosSin) {…}

    ComputeHull ¶

    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 MAX_POLYGON_VERTICES points This welds close points and removes collinear points.

    @warning Do not modify a hull once it has been computed
    

    ComputePolygonAABB ¶

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

    Compute the bounding box of a transformed polygon

    ComputePolygonMass ¶

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

    Compute mass properties of a polygon

    ComputeRotationBetweenUnitVectors ¶

    ComputeRotationBetweenUnitVectors :: proc(v1, v2: [2]f32) -> Rot {…}
     

    Compute the rotation between two unit vectors

    ComputeSegmentAABB ¶

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

    Compute the bounding box of a transformed line segment

    CreateBody ¶

    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{.odin}
    body_def := b2.DefaultBodyDef()
    my_body_id =: b2.CreateBody(my_world_id, body_def)
    @endcode
    

    @warning This function is locked during callbacks.

    CreateCapsuleShape ¶

    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
    

    CreateChain ¶

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

    Create a chain shape

    @see b2ChainDef for details
    

    CreateCircleShape ¶

    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 ¶

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

    Create a distance joint

    @see b2DistanceJointDef for details
    

    CreateFilterJoint ¶

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

    Create a filter joint. @see b2FilterJointDef for details

    CreateMotorJoint ¶

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

    Create a motor joint

    @see b2MotorJointDef for details
    

    CreateMouseJoint ¶

    CreateMouseJoint :: proc "c" (worldId: WorldId, #by_ptr def: MouseJointDef) -> JointId ---
     

    Create a mouse joint

    @see b2MouseJointDef for details
    

    CreatePolygonShape ¶

    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
    

    CreatePrismaticJoint ¶

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

    Create a prismatic (slider) joint.

    @see b2PrismaticJointDef for details
    

    CreateRevoluteJoint ¶

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

    Create a revolute joint

    @see b2RevoluteJointDef for details
    

    CreateSegmentShape ¶

    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 for accessing the shape
    

    CreateWeldJoint ¶

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

    Create a weld joint

    @see b2WeldJointDef for details
    

    CreateWheelJoint ¶

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

    Create a wheel joint

    @see b2WheelJointDef for details
    

    CreateWorld ¶

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

    Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You make create

    up to 128 worlds. Each world is completely independent and may be simulated in parallel.
    @return the world id.
    

    Cross ¶

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

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

    CrossSV ¶

    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 ¶

    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 ¶

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

    Use this to initialize your body definition @ingroup body

    DefaultChainDef ¶

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

    Use this to initialize your chain definition @ingroup shape

    DefaultDebugDraw ¶

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

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

    DefaultDistanceJointDef ¶

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

    Use this to initialize your joint definition @ingroup distance_joint

    DefaultExplosionDef ¶

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

    Use this to initialize your explosion definition @ingroup world

    DefaultFilter ¶

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

    Use this to initialize your filter @ingroup shape

    DefaultFilterJointDef ¶

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

    Use this to initialize your joint definition @ingroup filter_joint

    DefaultMotorJointDef ¶

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

    Use this to initialize your joint definition @ingroup motor_joint

    DefaultMouseJointDef ¶

    DefaultMouseJointDef :: proc "c" () -> MouseJointDef ---
     

    Use this to initialize your joint definition @ingroup mouse_joint

    DefaultPrismaticJointDef ¶

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

    Use this to initialize your joint definition @ingroupd prismatic_joint

    DefaultQueryFilter ¶

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

    Use this to initialize your query filter @ingroup shape

    DefaultRevoluteJointDef ¶

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

    Use this to initialize your joint definition. @ingroup revolute_joint

    DefaultShapeDef ¶

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

    Use this to initialize your shape definition @ingroup shape

    DefaultSurfaceMaterial ¶

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

    Use this to initialize your surface material @ingroup shape

    DefaultWeldJointDef ¶

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

    Use this to initialize your joint definition @ingroup weld_joint

    DefaultWheelJointDef ¶

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

    Use this to initialize your joint definition @ingroup wheel_joint

    DefaultWorldDef ¶

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

    Use this to initialize your world definition @ingroup world

    DestroyBody ¶

    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 ¶

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

    Destroy a chain shape

    DestroyJoint ¶

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

    Destroy a joint

    DestroyShape ¶

    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_ApplyMassFromShapes
    

    DestroyWorld ¶

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

    Destroy a world

    Distance ¶

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

    Get the distance between two points

    DistanceJoint_EnableLimit ¶

    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 ¶

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

    Enable/disable the distance joint motor

    DistanceJoint_EnableSpring ¶

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

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

    DistanceJoint_GetCurrentLength ¶

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

    Get the current length of a distance joint

    DistanceJoint_GetLength ¶

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

    Get the rest length of a distance joint

    DistanceJoint_GetMaxLength ¶

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

    Get the distance joint maximum length

    DistanceJoint_GetMaxMotorForce ¶

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

    Get the distance joint maximum motor force, usually in newtons

    DistanceJoint_GetMinLength ¶

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

    Get the distance joint minimum length

    DistanceJoint_GetMotorForce ¶

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

    Get the distance joint current motor force, usually in newtons

    DistanceJoint_GetMotorSpeed ¶

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

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

    DistanceJoint_GetSpringDampingRatio ¶

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

    Get the spring damping ratio

    DistanceJoint_GetSpringHertz ¶

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

    Get the spring Hertz

    DistanceJoint_IsLimitEnabled ¶

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

    Is the distance joint limit enabled?

    DistanceJoint_IsMotorEnabled ¶

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

    Is the distance joint motor enabled?

    DistanceJoint_IsSpringEnabled ¶

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

    Is the distance joint spring enabled?

    DistanceJoint_SetLength ¶

    DistanceJoint_SetLength :: 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_SetLengthRange ¶

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

    Set the minimum and maximum length parameters of a distance joint

    DistanceJoint_SetMaxMotorForce ¶

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

    Set the distance joint maximum motor force, usually in newtons

    DistanceJoint_SetMotorSpeed ¶

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

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

    DistanceJoint_SetSpringDampingRatio ¶

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

    Set the spring damping ratio, non-dimensional

    DistanceJoint_SetSpringHertz ¶

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

    Set the spring stiffness in Hertz

    DistanceSquared ¶

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

    Get the distance squared between points

    Dot ¶

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

    Vector dot product

    DynamicTree_Create ¶

    DynamicTree_Create :: proc "c" () -> DynamicTree ---
     

    Constructing the tree initializes the node pool.

    DynamicTree_CreateProxy ¶

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

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

    DynamicTree_Destroy ¶

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

    Destroy the tree, freeing the node pool.

    DynamicTree_DestroyProxy ¶

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

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

    DynamicTree_EnlargeProxy ¶

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

    Enlarge a proxy and enlarge ancestors as necessary.

    DynamicTree_GetAABB ¶

    DynamicTree_GetAABB :: proc "c" (#by_ptr tree: DynamicTree, proxyId: i32) -> AABB ---
     

    Get the AABB of a proxy

    DynamicTree_GetAreaRatio ¶

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

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

    DynamicTree_GetByteCount ¶

    DynamicTree_GetByteCount :: proc "c" (#by_ptr tree: DynamicTree) -> i32 ---
     

    Get the number of bytes used by this tree

    DynamicTree_GetCategoryBits ¶

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

    Get the category bits on a proxy.

    DynamicTree_GetHeight ¶

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

    Get the height of the binary tree.

    DynamicTree_GetProxyCount ¶

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

    Get the number of proxies created

    DynamicTree_GetRootBounds ¶

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

    Get the bounding box that contains the entire tree

    DynamicTree_GetUserData ¶

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

    Get proxy user data

    DynamicTree_MoveProxy ¶

    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_Query ¶

    DynamicTree_Query :: proc "c" (#by_ptr tree: DynamicTree, aabb: AABB, maskBits: u64, callback: TreeQueryCallbackFcn, ctx: rawptr) -> TreeStats ---
     

    Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.

    @return performance data
    

    DynamicTree_RayCast ¶

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

    Ray cast against the proxies in the tree. This relies on the callback to perform a exact ray cast in the case were the proxy contains a shape. The callback also performs the 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 greatly 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. The ray extends from p1 to p1 + maxFraction * (p2 - p1) @param maskBits mask bit hint: bool accept = (maskBits & node->categoryBits) != 0; @param callback a callback class 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_Rebuild ¶

    DynamicTree_Rebuild :: proc "c" (tree: ^DynamicTree, fullBuild: bool) -> i32 ---
     

    Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.

    DynamicTree_SetCategoryBits ¶

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

    Modify the category bits on a proxy. This is an expensive operation.

    DynamicTree_ShapeCast ¶

    DynamicTree_ShapeCast :: proc "c" (#by_ptr tree: DynamicTree, #by_ptr input: ShapeCastInput, maskBits: u32, callback: TreeShapeCastCallbackFcn, ctx: rawptr) -> TreeStats ---
     

    Ray cast against the proxies in the tree. This relies on the callback to perform a exact ray cast in the case were the proxy contains a shape. The callback also performs the 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.

    @param tree the dynamic tree to ray cast
    

    @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).

    @param maskBits filter bits: `bool accept = (maskBits & node->categoryBits) != 0 ---`
    

    @param callback a callback class that is called for each proxy that is hit by the shape

    @param context user context that is passed to the callback
    @return performance data
    

    DynamicTree_Validate ¶

    DynamicTree_Validate :: proc "c" (#by_ptr tree: DynamicTree) ---
     

    Validate this tree. For testing.

    DynamicTree_ValidateNoEnlarged ¶

    DynamicTree_ValidateNoEnlarged :: proc "c" (#by_ptr tree: DynamicTree) ---
     

    Validate this tree has no enlarged AABBs. For testing.

    GetByteCount ¶

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

    @return the total bytes allocated by Box2D

    GetInverse22 ¶

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

    Get the inverse of a 2-by-2 matrix

    GetLengthAndNormalize ¶

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

    GetLengthUnitsPerMeter ¶

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

    Get the current length units per meter.

    GetMilliseconds ¶

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

    Get the milliseconds passed from an initial tick value.

    GetMillisecondsAndReset ¶

    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 ¶

    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.

    GetWorldPointVelocity ¶

    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.

    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 b2WorldId.

    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 ¶

    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 ¶

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

    Transpose multiply two rotations: qT * r

    InvMulTransforms ¶

    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)

    InvRotateVector ¶

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

    Inverse rotate a vector

    InvTransformPoint ¶

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

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

    IsNormalized ¶

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

    IsNormalizedRot ¶

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

    Is this rotation normalized?

    IsValidAABB ¶

    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 ¶

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

    IsValidPlane ¶

    IsValidPlane :: proc "c" (plane: Plane) -> bool {…}
     

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

    IsValidRay ¶

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

    Validate ray cast input data (NaN, etc)

    IsValidRotation ¶

    IsValidRotation :: proc "c" (q: Rot) -> bool {…}

    IsValidVec2 ¶

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

    Joint_GetBodyA ¶

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

    Get body A id on a joint

    Joint_GetBodyB ¶

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

    Get body B id on a joint

    Joint_GetCollideConnected ¶

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

    Is collision allowed between connected bodies?

    Joint_GetConstraintForce ¶

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

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

    Joint_GetConstraintTorque ¶

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

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

    Joint_GetLocalAnchorA ¶

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

    Get the local anchor on bodyA

    Joint_GetLocalAnchorB ¶

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

    Get the local anchor on bodyB

    Joint_GetType ¶

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

    Get the joint type

    Joint_GetUserData ¶

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

    Get the user data on a joint

    Joint_GetWorld ¶

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

    Get the world that owns this joint

    Joint_IsValid ¶

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

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

    Joint_SetCollideConnected ¶

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

    Toggle collision between connected bodies

    Joint_SetUserData ¶

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

    Set the user data on a joint

    Joint_WakeBodies ¶

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

    Wake the bodies connect to this joint

    LeftPerp ¶

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

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

    Length ¶

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

    Get the length of this vector (the norm)

    LengthSquared ¶

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

    Get the length squared of this vector

    Lerp ¶

    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/

    MakeAABB ¶

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

    Compute the bounding box of an array of circles

    MakeBox ¶

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

    Make a box (rectangle) polygon, bypassing the need for a convex hull.

    MakeOffsetBox ¶

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

    Make an offset box, bypassing the need for a convex hull.

    MakeOffsetPolygon ¶

    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 ¶

    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 ¶

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

    Make an offset rounded box, bypassing the need for a convex hull.

    MakeOffsetRoundedPolygon ¶

    MakeOffsetRoundedPolygon :: proc "c" (#by_ptr hull: Hull, position: [2]f32, rotation: Rot, radius: f32) -> 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

    MakePolygon ¶

    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 ¶

    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 ¶

    MakeRot :: proc "c" (angle: f32) -> Rot {…}
     

    Make a rotation using an angle in radians

    MakeRoundedBox ¶

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

    Make a rounded box, bypassing the need for a convex hull.

    MakeSquare ¶

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

    Make a square polygon, bypassing the need for a convex hull.

    Max ¶

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

    Component-wise maximum vector

    MaxFloat ¶

    MaxFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the maximum of two floats

    MaxInt ¶

    MaxInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the maximum of two integers

    Min ¶

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

    Component-wise minimum vector

    MinFloat ¶

    MinFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the minimum of two floats

    MinInt ¶

    MinInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the minimum of two integers

    MotorJoint_GetAngularOffset ¶

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

    Get the motor joint angular offset target in radians

    MotorJoint_GetCorrectionFactor ¶

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

    Get the motor joint correction factor, usually in [0, 1]

    MotorJoint_GetLinearOffset ¶

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

    Get the motor joint linear offset target

    MotorJoint_GetMaxForce ¶

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

    Get the motor joint maximum force, usually in newtons

    MotorJoint_GetMaxTorque ¶

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

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

    MotorJoint_SetAngularOffset ¶

    MotorJoint_SetAngularOffset :: proc "c" (jointId: JointId, angularOffset: f32) ---
     

    Set the motor joint angular offset target in radians

    MotorJoint_SetCorrectionFactor ¶

    MotorJoint_SetCorrectionFactor :: proc "c" (jointId: JointId, correctionFactor: f32) ---
     

    Set the motor joint correction factor, usually in [0, 1]

    MotorJoint_SetLinearOffset ¶

    MotorJoint_SetLinearOffset :: proc "c" (jointId: JointId, linearOffset: [2]f32) ---
     

    Set the motor joint linear offset target

    MotorJoint_SetMaxForce ¶

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

    Set the motor joint maximum force, usually in newtons

    MotorJoint_SetMaxTorque ¶

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

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

    MouseJoint_GetMaxForce ¶

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

    Get the mouse joint maximum force, usually in newtons

    MouseJoint_GetSpringDampingRatio ¶

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

    Get the mouse joint damping ratio, non-dimensional

    MouseJoint_GetSpringHertz ¶

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

    Get the mouse joint spring stiffness in Hertz

    MouseJoint_GetTarget ¶

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

    Get the mouse joint target

    MouseJoint_SetMaxForce ¶

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

    Set the mouse joint maximum force, usually in newtons

    MouseJoint_SetSpringDampingRatio ¶

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

    Set the mouse joint spring damping ratio, non-dimensional

    MouseJoint_SetSpringHertz ¶

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

    Set the mouse joint spring stiffness in Hertz

    MouseJoint_SetTarget ¶

    MouseJoint_SetTarget :: proc "c" (jointId: JointId, target: [2]f32) ---
     

    Set the mouse joint target

    Mul ¶

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

    Component-wise multiplication

    MulAdd ¶

    MulAdd :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a + s * b

    MulMV ¶

    MulMV :: proc "c" (A: matrix[2, 2]f32, v: [2]f32) -> [2]f32 {…}
     

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

    MulRot ¶

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

    Multiply two rotations: q * r

    MulSV ¶

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

    Multiply a scalar and vector

    MulSub ¶

    MulSub :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a - s * b

    MulTransforms ¶

    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

    NLerp ¶

    NLerp :: proc "c" (q1: Rot, q2: Rot, t: f32) -> Rot {…}
     

    Normalized linear interpolation https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/ https://web.archive.org/web/20170825184056/http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

    Neg ¶

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

    Vector negation

    Normalize ¶

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

    NormalizeChecked ¶

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

    NormalizeRot ¶

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

    Normalize rotation

    PlaneSeparation ¶

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

    Signed separation of a point from a plane

    PointInCapsule ¶

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

    Test a point for overlap with a capsule in local space

    PointInCircle ¶

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

    Test a point for overlap with a circle in local space

    PointInPolygon ¶

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

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

    PrismaticJoint_EnableLimit ¶

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

    Enable/disable a prismatic joint limit

    PrismaticJoint_EnableMotor ¶

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

    Enable/disable a prismatic joint motor

    PrismaticJoint_EnableSpring ¶

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

    Enable/disable the joint spring.

    PrismaticJoint_GetLowerLimit ¶

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

    Get the prismatic joint lower limit

    PrismaticJoint_GetMaxMotorForce ¶

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

    Get the prismatic joint maximum motor force, usually in newtons

    PrismaticJoint_GetMotorForce ¶

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

    Get the prismatic joint current motor force, usually in newtons

    PrismaticJoint_GetMotorSpeed ¶

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

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

    PrismaticJoint_GetSpeed ¶

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

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

    PrismaticJoint_GetSpringDampingRatio ¶

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

    Get the prismatic spring damping ratio (non-dimensional)

    PrismaticJoint_GetSpringHertz ¶

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

    Get the prismatic joint stiffness in Hertz

    PrismaticJoint_GetTranslation ¶

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

    Get the current joint translation, usually in meters.

    PrismaticJoint_GetUpperLimit ¶

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

    Get the prismatic joint upper limit

    PrismaticJoint_IsLimitEnabled ¶

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

    Is the prismatic joint limit enabled?

    PrismaticJoint_IsMotorEnabled ¶

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

    Is the prismatic joint motor enabled?

    PrismaticJoint_IsSpringEnabled ¶

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

    Is the prismatic joint spring enabled or not?

    PrismaticJoint_SetLimits ¶

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

    Set the prismatic joint limits

    PrismaticJoint_SetMaxMotorForce ¶

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

    Set the prismatic joint maximum motor force, usually in newtons

    PrismaticJoint_SetMotorSpeed ¶

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

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

    PrismaticJoint_SetSpringDampingRatio ¶

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

    Set the prismatic joint damping ratio (non-dimensional)

    PrismaticJoint_SetSpringHertz ¶

    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.

    RayCastCapsule ¶

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

    Ray cast versus capsule in shape local space. Initial overlap is treated as a miss.

    RayCastCircle ¶

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

    Ray cast versus circle in shape local space. Initial overlap is treated as a miss.

    RayCastPolygon ¶

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

    Ray cast versus polygon in shape local space. Initial overlap is treated as a miss.

    RayCastSegment ¶

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

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

    RelativeAngle ¶

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

    relative angle between b and a (rot_b * inv(rot_a))

    RevoluteJoint_EnableLimit ¶

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

    Enable/disable the revolute joint limit

    RevoluteJoint_EnableMotor ¶

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

    Enable/disable a revolute joint motor

    RevoluteJoint_EnableSpring ¶

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

    Enable/disable the revolute joint spring

    RevoluteJoint_GetAngle ¶

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

    Get the revolute joint current angle in radians relative to the reference angle

    @see b2RevoluteJointDef::referenceAngle
    

    RevoluteJoint_GetLowerLimit ¶

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

    Get the revolute joint lower limit in radians

    RevoluteJoint_GetMaxMotorTorque ¶

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

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

    RevoluteJoint_GetMotorSpeed ¶

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

    Get the revolute joint motor speed in radians per second

    RevoluteJoint_GetMotorTorque ¶

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

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

    RevoluteJoint_GetSpringDampingRatio ¶

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

    Get the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_GetSpringHertz ¶

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

    Get the revolute joint spring stiffness in Hertz

    RevoluteJoint_GetUpperLimit ¶

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

    Get the revolute joint upper limit in radians

    RevoluteJoint_IsLimitEnabled ¶

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

    Is the revolute joint limit enabled?

    RevoluteJoint_IsMotorEnabled ¶

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

    Is the revolute joint motor enabled?

    RevoluteJoint_IsSpringEnabled ¶

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

    Is the revolute spring enabled?

    RevoluteJoint_SetLimits ¶

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

    Set the revolute joint limits in radians. It is expected that lower <= upper and that -0.95 B2_PI <= lower && upper <= -0.95 B2_PI.

    RevoluteJoint_SetMaxMotorTorque ¶

    RevoluteJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---
     

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

    RevoluteJoint_SetMotorSpeed ¶

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

    Set the revolute joint motor speed in radians per second

    RevoluteJoint_SetSpringDampingRatio ¶

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

    Set the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_SetSpringHertz ¶

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

    Set the revolute joint spring stiffness in Hertz

    RightPerp ¶

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

    Get a right pointing perpendicular vector. Equivalent to b2CrossVS(v, 1)

    Rot_GetAngle ¶

    Rot_GetAngle :: proc "c" (q: Rot) -> f32 {…}
     

    Get the angle in radians in the range [-pi, pi]

    Rot_GetXAxis ¶

    Rot_GetXAxis :: proc "c" (q: Rot) -> [2]f32 {…}
     

    Get the x-axis

    Rot_GetYAxis ¶

    Rot_GetYAxis :: proc "c" (q: Rot) -> [2]f32 {…}
     

    Get the y-axis

    RotateVector ¶

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

    Rotate a vector

    SegmentDistance ¶

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

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

    SetAllocator ¶

    SetAllocator :: proc "c" (allocFcn: AllocFcn, freefcn: FreeFcn) ---
     

    This allows the user to override the allocation functions. These should be

    set during application startup.
    

    SetAssertFcn ¶

    SetAssertFcn :: proc "c" (assertfcn: AssertFcn) ---
     

    Override the default assert callback

    @param assertFcn a non-null assert callback
    

    SetLengthUnitsPerMeter ¶

    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

    ShapeCast ¶

    ShapeCast :: 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. You may optionally supply an array to hold debug data.

    ShapeCastCapsule ¶

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

    Shape cast versus a capsule. Initial overlap is treated as a miss.

    ShapeCastCircle ¶

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

    Shape cast versus a circle. Initial overlap is treated as a miss.

    ShapeCastPolygon ¶

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

    Shape cast versus a convex polygon. Initial overlap is treated as a miss.

    ShapeCastSegment ¶

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

    Shape cast versus a line segment. Initial overlap is treated as a miss.

    ShapeDistance ¶

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

    Compute the closest points between two shapes represented as point clouds. SimplexCache cache is input/output. On the first call set SimplexCache.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.
    

    Shape_AreContactEventsEnabled ¶

    Shape_AreContactEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if contact events are enabled

    Shape_AreHitEventsEnabled ¶

    Shape_AreHitEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if hit events are enabled

    Shape_ArePreSolveEventsEnabled ¶

    Shape_ArePreSolveEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if pre-solve events are enabled

    Shape_AreSensorEventsEnabled ¶

    Shape_AreSensorEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---
     

    Returns true if sensor events are enabled

    Shape_EnableContactEvents ¶

    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 ¶

    Shape_EnableHitEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable contact hit events for this shape. Ignored for sensors.

    @see WorldDef.hitEventThreshold
    

    Shape_EnablePreSolveEvents ¶

    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 b2PreSolveFcn
    

    Shape_EnableSensorEvents ¶

    Shape_EnableSensorEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---
     

    Enable sensor events for this shape.

    @see b2ShapeDef::enableSensorEvents
    

    Shape_GetAABB ¶

    Shape_GetAABB :: proc "c" (shapeId: ShapeId) -> AABB ---
     

    Get the current world AABB

    Shape_GetBody ¶

    Shape_GetBody :: proc "c" (shapeId: ShapeId) -> BodyId ---
     

    Get the id of the body that a shape is attached to

    Shape_GetCapsule ¶

    Shape_GetCapsule :: proc "c" (shapeId: ShapeId) -> Capsule ---
     

    Get a copy of the shape's capsule. Asserts the type is correct.

    Shape_GetChainSegment ¶

    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 ¶

    Shape_GetCircle :: proc "c" (shapeId: ShapeId) -> Circle ---
     

    Get a copy of the shape's circle. Asserts the type is correct.

    Shape_GetClosestPoint ¶

    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 in world space.

    Shape_GetContactCapacity ¶

    Shape_GetContactCapacity :: proc "c" (shapeId: ShapeId) -> i32 ---
     

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

    Shape_GetContactData ¶

    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.

    Shape_GetDensity ¶

    Shape_GetDensity :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the density of a shape, usually in kg/m^2

    Shape_GetFilter ¶

    Shape_GetFilter :: proc "c" (shapeId: ShapeId) -> Filter ---
     

    Get the shape filter

    Shape_GetFriction ¶

    Shape_GetFriction :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the friction of a shape

    Shape_GetMassData ¶

    Shape_GetMassData :: proc "c" (shapeId: ShapeId) -> MassData ---
     

    Get the mass data of a shape

    Shape_GetMaterial ¶

    Shape_GetMaterial :: proc "c" (shapeId: ShapeId) -> i32 ---
     

    Get the shape material identifier

    Shape_GetParentChain ¶

    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 ¶

    Shape_GetPolygon :: proc "c" (shapeId: ShapeId) -> Polygon ---
     

    Get a copy of the shape's convex polygon. Asserts the type is correct.

    Shape_GetRestitution ¶

    Shape_GetRestitution :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the shape restitution

    Shape_GetSegment ¶

    Shape_GetSegment :: proc "c" (shapeId: ShapeId) -> Segment ---
     

    Get a copy of the shape's line segment. Asserts the type is correct.

    Shape_GetSensorCapacity ¶

    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_GetSensorOverlaps

    Shape_GetSensorOverlaps ¶

    Shape_GetSensorOverlaps :: proc "c" (shapeId: ShapeId, overlaps: [^]ShapeId, capacity: i32) -> i32 ---
     

    Get the overlapped shapes for a sensor shape. @param shapeId the id of a sensor shape @param overlaps a user allocated array that is filled with the overlapping shapes @param capacity the capacity of overlappedShapes @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_GetType ¶

    Shape_GetType :: proc "c" (shapeId: ShapeId) -> ShapeType ---
     

    Get the type of a shape

    Shape_GetUserData ¶

    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_GetWorld ¶

    Shape_GetWorld :: proc "c" (shapeId: ShapeId) -> WorldId ---
     

    Get the world that owns this shape.

    Shape_IsSensor ¶

    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 ¶

    Shape_IsValid :: proc "c" (id: ShapeId) -> bool ---
     

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

    Shape_RayCast ¶

    Shape_RayCast :: proc "c" (shapeId: ShapeId, #by_ptr input: RayCastInput) -> CastOutput ---
     

    Ray cast a shape directly

    Shape_SetCapsule ¶

    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_ApplyMassFromShapes
    

    Shape_SetCircle ¶

    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_ApplyMassFromShapes
    

    Shape_SetDensity ¶

    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_ApplyMassFromShapes
    

    Shape_SetFilter ¶

    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 ¶

    Shape_SetFriction :: proc "c" (shapeId: ShapeId, friction: f32) ---
     

    Set the friction on a shape

    @see b2ShapeDef::friction
    

    Shape_SetMaterial ¶

    Shape_SetMaterial :: proc "c" (shapeId: ShapeId, material: i32) ---
     

    Set the shape material identifier @see b2ShapeDef::material

    Shape_SetPolygon ¶

    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_ApplyMassFromShapes
    

    Shape_SetRestitution ¶

    Shape_SetRestitution :: proc "c" (shapeId: ShapeId, restitution: f32) ---
     

    Set the shape restitution (bounciness)

    @see b2ShapeDef::restitution
    

    Shape_SetSegment ¶

    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_SetUserData ¶

    Shape_SetUserData :: proc "c" (shapeId: ShapeId, userData: rawptr) ---
     

    Set the user data for a shape

    Shape_TestPoint ¶

    Shape_TestPoint :: proc "c" (shapeId: ShapeId, point: [2]f32) -> bool ---
     

    Test a point for overlap with a shape

    Solve22 ¶

    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 ¶

    SolvePlanes :: proc(position: [2]f32, planes: []CollisionPlane) -> PlaneSolverResult {…}

    Sub ¶

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

    Vector subtraction

    TimeOfImpact ¶

    TimeOfImpact :: 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,tMax]. 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.

    TransformPoint ¶

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

    Transform a point (e.g. local space to world space)

    TransformPolygon ¶

    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.

    UnwindAngle ¶

    UnwindAngle :: proc "c" (radians: f32) -> f32 {…}
     

    Convert an angle in the range [-2pi, 2pi] into the range [-pi, pi]

    UnwindLargeAngle ¶

    UnwindLargeAngle :: proc "c" (radians: f32) -> f32 {…}
     

    Convert any into the range [-pi, pi] (slow)

    ValidateHull ¶

    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.

    WeldJoint_GetAngularDampingRatio ¶

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

    Get the weld joint angular damping ratio, non-dimensional

    WeldJoint_GetAngularHertz ¶

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

    Get the weld joint angular stiffness in Hertz

    WeldJoint_GetLinearDampingRatio ¶

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

    Get the weld joint linear damping ratio (non-dimensional)

    WeldJoint_GetLinearHertz ¶

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

    Get the weld joint linear stiffness in Hertz

    WeldJoint_GetReferenceAngle ¶

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

    Get the weld joint reference angle in radians

    WeldJoint_SetAngularDampingRatio ¶

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

    Set weld joint angular damping ratio, non-dimensional

    WeldJoint_SetAngularHertz ¶

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

    Set the weld joint angular stiffness in Hertz. 0 is rigid.

    WeldJoint_SetLinearDampingRatio ¶

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

    Set the weld joint linear damping ratio (non-dimensional)

    WeldJoint_SetLinearHertz ¶

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

    Set the weld joint linear stiffness in Hertz. 0 is rigid.

    WeldJoint_SetReferenceAngle ¶

    WeldJoint_SetReferenceAngle :: proc "c" (jointId: JointId, angleInRadians: f32) ---
     

    Set the weld joint reference angle in radians, must be in [-pi,pi].

    WheelJoint_EnableLimit ¶

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

    Enable/disable the wheel joint limit

    WheelJoint_EnableMotor ¶

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

    Enable/disable the wheel joint motor

    WheelJoint_EnableSpring ¶

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

    Enable/disable the wheel joint spring

    WheelJoint_GetLowerLimit ¶

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

    Get the wheel joint lower limit

    WheelJoint_GetMaxMotorTorque ¶

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

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

    WheelJoint_GetMotorSpeed ¶

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

    Get the wheel joint motor speed in radians per second

    WheelJoint_GetMotorTorque ¶

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

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

    WheelJoint_GetSpringDampingRatio ¶

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

    Get the wheel joint damping ratio, non-dimensional

    WheelJoint_GetSpringHertz ¶

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

    Get the wheel joint stiffness in Hertz

    WheelJoint_GetUpperLimit ¶

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

    Get the wheel joint upper limit

    WheelJoint_IsLimitEnabled ¶

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

    Is the wheel joint limit enabled?

    WheelJoint_IsMotorEnabled ¶

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

    Is the wheel joint motor enabled?

    WheelJoint_IsSpringEnabled ¶

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

    Is the wheel joint spring enabled?

    WheelJoint_SetLimits ¶

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

    Set the wheel joint limits

    WheelJoint_SetMaxMotorTorque ¶

    WheelJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---
     

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

    WheelJoint_SetMotorSpeed ¶

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

    Set the wheel joint motor speed in radians per second

    WheelJoint_SetSpringDampingRatio ¶

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

    Set the wheel joint damping ratio, non-dimensional

    WheelJoint_SetSpringHertz ¶

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

    Set the wheel joint stiffness in Hertz

    World_CastMover ¶

    World_CastMover :: proc "c" (worldId: WorldId, #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.

    World_CastRay ¶

    World_CastRay :: proc "c" (
    	worldId:     WorldId, 
    	origin:      [2]f32, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    	fcn:         CastResultFcn, 
    	ctx:         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. The ray-cast ignores shapes that contain the starting point.

    @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 ¶

    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. This is less general than b2World_CastRay() and does not allow for custom filtering.

    World_CastShape ¶

    World_CastShape :: proc "c" (
    	worldId:     WorldId, 
    	#by_ptr shape: ShapeProxy, 
    	translation: [2]f32, 
    	filter:      QueryFilter, 
    	fcn:         CastResultFcn, 
    	ctx:         rawptr, 
    ) -> TreeStats ---
     

    Cast a shape through the world. Similar to a cast ray except that a shape is cast instead of a point. @see World_CastRay

    World_CollideMover ¶

    World_CollideMover :: proc "c" (worldId: WorldId, #by_ptr mover: Capsule, filter: QueryFilter, fcn: PlaneResultFcn, ctx: rawptr) ---
     

    Collide a capsule mover with the world, gathering collision planes that can be fed to b2SolvePlanes. Useful for kinematic character movement.

    World_Draw ¶

    World_Draw :: proc "c" (worldId: WorldId, draw: ^DebugDraw) ---
     

    Call this to draw shapes and other debug draw data

    World_DumpMemoryStats ¶

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

    Dump memory stats to box2d_memory.txt

    World_EnableContinuous ¶

    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 WorldDef
    

    World_EnableSleeping ¶

    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 WorldDef
    

    World_EnableSpeculative ¶

    World_EnableSpeculative :: proc "c" (worldId: WorldId, flag: bool) ---
     

    This is for internal testing

    World_EnableWarmStarting ¶

    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 ¶

    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 ¶

    World_GetAwakeBodyCount :: proc "c" (worldId: WorldId) -> i32 ---
     

    Get the number of awake bodies.

    World_GetBodyEvents ¶

    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_GetContactEvents ¶

    World_GetContactEvents :: proc "c" (worldId: WorldId) -> ContactEvents ---
     

    Get contact events for this current time step. The event data is transient. Do not store a reference to this data.

    World_GetCounters ¶

    World_GetCounters :: proc "c" (worldId: WorldId) -> Counters ---
     

    Get world counters and sizes

    World_GetGravity ¶

    World_GetGravity :: proc "c" (worldId: WorldId) -> [2]f32 ---
     

    Get the gravity vector

    World_GetHitEventThreshold ¶

    World_GetHitEventThreshold :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the hit event speed threshold. Usually in meters per second.

    World_GetMaximumLinearSpeed ¶

    World_GetMaximumLinearSpeed :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the maximum linear speed. Usually in m/s.

    World_GetProfile ¶

    World_GetProfile :: proc "c" (worldId: WorldId) -> Profile ---
     

    Get the current world performance profile

    World_GetRestitutionThreshold ¶

    World_GetRestitutionThreshold :: proc "c" (worldId: WorldId) -> f32 ---
     

    Get the restitution speed threshold. Usually in meters per second.

    World_GetSensorEvents ¶

    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_GetUserData ¶

    World_GetUserData :: proc "c" (worldId: WorldId) -> rawptr ---
     

    Get the user data pointer.

    World_IsContinuousEnabled ¶

    World_IsContinuousEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is continuous collision enabled?

    World_IsSleepingEnabled ¶

    World_IsSleepingEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is body sleeping enabled?

    World_IsValid ¶

    World_IsValid :: proc "c" (id: WorldId) -> bool ---
     

    World id validation. Provides validation for up to 64K allocations.

    World_IsWarmStartingEnabled ¶

    World_IsWarmStartingEnabled :: proc "c" (worldId: WorldId) -> bool ---
     

    Is constraint warm starting enabled?

    World_OverlapAABB ¶

    World_OverlapAABB :: proc "c" (worldId: WorldId, aabb: AABB, filter: QueryFilter, fcn: OverlapResultFcn, ctx: rawptr) -> TreeStats ---
     

    Overlap test for all shapes that potentially overlap the provided AABB

    World_OverlapShape ¶

    World_OverlapShape :: proc "c" (worldId: WorldId, #by_ptr proxy: ShapeProxy, filter: QueryFilter, fcn: OverlapResultFcn, ctx: rawptr) -> TreeStats ---
     

    Overlap test for all shapes that overlap the provided shape proxy.

    World_RebuildStaticTree ¶

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

    This is for internal testing

    World_SetContactTuning ¶

    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 ¶

    World_SetCustomFilterCallback :: proc "c" (worldId: WorldId, fcn: CustomFilterFcn, ctx: rawptr) ---
     

    Register the custom filter callback. This is optional.

    World_SetFrictionCallback ¶

    World_SetFrictionCallback :: proc "c" (worldId: WorldId, callback: FrictionCallback) ---
     

    Set the friction callback. Passing nil resets to default.

    World_SetGravity ¶

    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 WorldDef
    

    World_SetHitEventThreshold ¶

    World_SetHitEventThreshold :: proc "c" (worldId: WorldId, value: f32) ---
     

    Adjust the hit event threshold. This controls the collision velocity needed to generate a b2ContactHitEvent. Usually in meters per second.

    @see WorldDef::hitEventThreshold
    

    World_SetJointTuning ¶

    World_SetJointTuning :: proc "c" (worldId: WorldId, hertz: f32, dampingRatio: f32) ---
     

    Adjust joint 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) @note Advanced feature

    World_SetMaximumLinearSpeed ¶

    World_SetMaximumLinearSpeed :: proc "c" (worldId: WorldId, maximumLinearSpeed: f32) ---
     

    Set the maximum linear speed. Usually in m/s.

    World_SetPreSolveCallback ¶

    World_SetPreSolveCallback :: proc "c" (worldId: WorldId, fcn: PreSolveFcn, ctx: rawptr) ---
     

    Register the pre-solve callback. This is optional.

    World_SetRestitutionCallback ¶

    World_SetRestitutionCallback :: proc "c" (worldId: WorldId, callback: RestitutionCallback) ---
     

    Set the restitution callback. Passing nil resets to default.

    World_SetRestitutionThreshold ¶

    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 WorldDef
    

    World_SetUserData ¶

    World_SetUserData :: proc "c" (worldId: WorldId, userData: rawptr) ---
     

    Set the user data pointer.

    World_Step ¶

    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.

    Yield ¶

    Yield :: proc "c" () ---
     

    Yield to be used in a busy loop.

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2025-05 (vendor "odin") Windows_amd64 @ 2025-05-06 21:13:12.590521300 +0000 UTC