HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
Box2D Namespace Reference

Classes

struct  AABB
 An Axis-Aligned Bounding Box. More...
 
struct  Body
 A Box2D physics body. The body's transform is the base transform for all shapes attached to this body. More...
 
class  BodyDef
 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. More...
 
struct  BodyEvents
 Body events are buffered in the Box2D world and are available as event arrays after the time step is complete. Note: this data becomes invalid if bodies are destroyed More...
 
struct  BodyMoveEvent
 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 Body.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. More...
 
struct  Box2DVersion
 Box2D version information. More...
 
struct  Capsule
 A solid capsule can be viewed as two semicircles connected by a rectangle. More...
 
struct  CastOutput
 Low level ray cast or shape-cast output data. More...
 
class  ChainDef
 Used to create a chain of line segments. This is designed to eliminate ghost collisions with some limitations. More...
 
struct  ChainSegment
 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. More...
 
struct  ChainShape
 A chain shape is a series of connected line segments. More...
 
struct  Circle
 A solid circle. More...
 
struct  ContactBeginTouchEvent
 A begin touch event is generated when two shapes begin touching. More...
 
struct  ContactData
 The contact data for two shapes. By convention the manifold normal points from shape A to shape B. More...
 
struct  ContactEndTouchEvent
 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. More...
 
struct  ContactEvents
 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 More...
 
struct  ContactHitEvent
 A hit touch event is generated when two shapes collide with a speed faster than the hit speed threshold. More...
 
struct  Counters
 Counters that give details of the simulation size. More...
 
class  DebugDraw
 Debug Draw base class. You cannot set DebugDraw delegates with this class. Use an instance of one of these implementations: More...
 
class  DebugDrawGeneric
 This class holds callbacks you can implement to draw a Box2D world. More...
 
class  DebugDrawGenericBase
 Base class for DebugDrawGeneric implementations - i.e. those that receive a managed type context. More...
 
struct  DebugDrawInternal
 This struct holds callbacks you can implement to draw a Box2D world. This structure should be zero initialized. More...
 
class  DebugDrawSimple
 This class holds callbacks you can implement to draw a Box2D world. More...
 
class  DebugDrawSimpleBase
 Base class for simple debug draw implementations - i.e. without context. More...
 
class  DebugDrawUnsafe
 This class holds callbacks you can implement to draw a Box2D world. More...
 
class  DebugDrawUnsafeBase
 Base class for unsafe debug draw implementations - i.e. those that use pointers. More...
 
struct  DistanceInput
 Input for ShapeDistance. More...
 
class  DistanceJoint
 A distance joint.
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. More...
 
class  DistanceJointDef
 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. More...
 
struct  DistanceOutput
 Output for ShapeDistance. More...
 
struct  DynamicTree
 Dynamic tree for broad-phase collision detection. More...
 
struct  ExplosionDef
 The explosion definition is used to configure options for explosions. Explosions consider shape geometry when computing the impulse. More...
 
struct  Filter
 This is used to filter collision on shapes. It affects shape-vs-shape collision and shape-versus-query collision (such as World.CastRay). More...
 
class  FilterJointDef
 The filter joint is used to disable collision between two bodies. As a side effect of being a joint, it also keeps the two bodies in the same simulation island. More...
 
class  Gears
 Gear calculation functionality no included in Box2D. More...
 
struct  Hull
 A convex hull. Used to create convex polygons. More...
 
class  Joint
 Joints allow you to connect rigid bodies together while allowing various forms of relative motions. More...
 
struct  Manifold
 A contact manifold describes the contact points between colliding shapes. More...
 
struct  ManifoldPoint
 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 maxNormalImpulse to determine if there was an interaction during the time step. More...
 
struct  MassData
 This holds the mass data computed for a shape. More...
 
class  MotorJoint
 The motor joint is used to drive the relative transform between two bodies. It takes a relative position and rotation and applies the forces and torques needed to achieve that relative transform over time. More...
 
class  MotorJointDef
 A motor joint is used to control the relative motion between two bodies
More...
 
class  MouseJoint
 The mouse joint is designed for use in the samples application, but you may find it useful in applications where the user moves a rigid body with a cursor. More...
 
class  MouseJointDef
 A mouse joint is used to make a point on a body track a specified world point.
More...
 
struct  Polygon
 A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to B2_MAX_POLYGON_VERTICES. In most cases you should not need many vertices for a convex polygon. Warning: DO NOT fill this out manually, instead use a helper function like MakePolygon or MakeBox. More...
 
class  PrismaticJoint
 A prismatic joint allows for translation along a single axis with no rotation. More...
 
class  PrismaticJointDef
 Prismatic joint definition
More...
 
struct  Profile
 Profiling data for Box2D. All times are in milliseconds. More...
 
struct  QueryFilter
 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. More...
 
struct  RayCastInput
 Low level ray cast input data. More...
 
struct  RayResult
 Results of a Box2D raycast query, including intersection details and traversal statistics. More...
 
class  RevoluteJoint
 A revolute joint allows for relative rotation in the 2D plane with no relative translation. More...
 
class  RevoluteJointDef
 Revolute joint definition
More...
 
struct  Rotation
 Rotation expressed as a cosine and sine. More...
 
struct  Segment
 A line segment with two-sided collision. More...
 
struct  SegmentDistanceResult
 Result of computing the distance between two line segments. More...
 
struct  SensorBeginTouchEvent
 A begin touch event is generated when a shape starts to overlap a sensor shape. More...
 
struct  SensorEndTouchEvent
 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 is valid using Shape.Valid. More...
 
struct  SensorEvents
 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. More...
 
struct  Shape
 A shape is a geometric object used for collision detection. More...
 
struct  ShapeCastInput
 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. More...
 
struct  ShapeCastPairInput
 Input parameters for ShapeCast. More...
 
class  ShapeDef
 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. More...
 
struct  ShapeProxy
 A distance proxy is used by the GJK algorithm. It encapsulates any shape. You can provide between 1 and Constants.MAX_POLYGON_VERTICES and a radius. More...
 
struct  Simplex
 Simplex from the GJK algorithm. More...
 
struct  SimplexCache
 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. More...
 
struct  SimplexVertex
 Simplex vertex for debugging the GJK algorithm. More...
 
struct  SurfaceMaterial
 Surface materials allow chain shapes to have per segment surface properties. More...
 
struct  Sweep
 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. More...
 
struct  TOIInput
 Input parameters for TimeOfImpact. More...
 
struct  TOIOutput
 Output parameters for TimeOfImpact. More...
 
struct  Transform
 A transform contains translation and rotation. More...
 
struct  TreeChildren
 The children of a TreeNode. More...
 
struct  TreeNode
 A node in a DynamicTree. More...
 
struct  TreeStats
 These are performance results returned by dynamic tree queries. More...
 
class  WeldJoint
 A weld joint fully constrains the relative transform between two bodies while allowing for springiness A weld joint constrains the relative rotation and translation between two bodies. Both rotation and translation can have damped springs.
Note: The accuracy of weld joint is limited by the accuracy of the solver. Long chains of weld joints may flex. More...
 
class  WeldJointDef
 Weld joint definition
More...
 
class  WheelJoint
 The wheel joint can be used to simulate wheels on vehicles. More...
 
class  WheelJointDef
 Wheel joint definition. More...
 
class  World
 A Box2D World, the container for all bodies, shapes, and constraints. More...
 
class  WorldDef
 World definition used to create a simulation world. More...
 

Enumerations

enum  BodyType { Static = 0 , Kinematic = 1 , Dynamic = 2 }
 The body simulation type. Each body is one of these three types. The type determines how the body behaves in the simulation. More...
 
enum  TreeNodeFlags : ushort { AllocatedNode = 0x0001 , EnlargedNode = 0x0002 , LeafNode = 0x0004 }
 Flags for a TreeNode. More...
 
enum  HexColor : uint {
  AliceBlue = 0xF0F8FF , AntiqueWhite = 0xFAEBD7 , Aqua = 0x00FFFF , Aquamarine = 0x7FFFD4 ,
  Azure = 0xF0FFFF , Beige = 0xF5F5DC , Bisque = 0xFFE4C4 , Black = 0x000000 ,
  BlanchedAlmond = 0xFFEBCD , Blue = 0x0000FF , BlueViolet = 0x8A2BE2 , Brown = 0xA52A2A ,
  Burlywood = 0xDEB887 , CadetBlue = 0x5F9EA0 , Chartreuse = 0x7FFF00 , Chocolate = 0xD2691E ,
  Coral = 0xFF7F50 , CornflowerBlue = 0x6495ED , Cornsilk = 0xFFF8DC , Crimson = 0xDC143C ,
  Cyan = 0x00FFFF , DarkBlue = 0x00008B , DarkCyan = 0x008B8B , DarkGoldenRod = 0xB8860B ,
  DarkGray = 0xA9A9A9 , DarkGreen = 0x006400 , DarkKhaki = 0xBDB76B , DarkMagenta = 0x8B008B ,
  DarkOliveGreen = 0x556B2F , DarkOrange = 0xFF8C00 , DarkOrchid = 0x9932CC , DarkRed = 0x8B0000 ,
  DarkSalmon = 0xE9967A , DarkSeaGreen = 0x8FBC8F , DarkSlateBlue = 0x483D8B , DarkSlateGray = 0x2F4F4F ,
  DarkTurquoise = 0x00CED1 , DarkViolet = 0x9400D3 , DeepPink = 0xFF1493 , DeepSkyBlue = 0x00BFFF ,
  DimGray = 0x696969 , DodgerBlue = 0x1E90FF , FireBrick = 0xB22222 , FloralWhite = 0xFFFAF0 ,
  ForestGreen = 0x228B22 , Fuchsia = 0xFF00FF , Gainsboro = 0xDCDCDC , GhostWhite = 0xF8F8FF ,
  Gold = 0xFFD700 , GoldenRod = 0xDAA520 , Gray = 0x808080 , Green = 0x008000 ,
  GreenYellow = 0xADFF2F , HoneyDew = 0xF0FFF0 , HotPink = 0xFF69B4 , IndianRed = 0xCD5C5C ,
  Indigo = 0x4B0082 , Ivory = 0xFFFFF0 , Khaki = 0xF0E68C , Lavender = 0xE6E6FA ,
  LavenderBlush = 0xFFF0F5 , LawnGreen = 0x7CFC00 , LemonChiffon = 0xFFFACD , LightBlue = 0xADD8E6 ,
  LightCoral = 0xF08080 , LightCyan = 0xE0FFFF , LightGoldenRodYellow = 0xFAFAD2 , LightGray = 0xD3D3D3 ,
  LightGreen = 0x90EE90 , LightPink = 0xFFB6C1 , LightSalmon = 0xFFA07A , LightSeaGreen = 0x20B2AA ,
  LightSkyBlue = 0x87CEFA , LightSlateGray = 0x778899 , LightSteelBlue = 0xB0C4DE , LightYellow = 0xFFFFE0 ,
  Lime = 0x00FF00 , LimeGreen = 0x32CD32 , Linen = 0xFAF0E6 , Magenta = 0xFF00FF ,
  Maroon = 0x800000 , MediumAquaMarine = 0x66CDAA , MediumBlue = 0x0000CD , MediumOrchid = 0xBA55D3 ,
  MediumPurple = 0x9370DB , MediumSeaGreen = 0x3CB371 , MediumSlateBlue = 0x7B68EE , MediumSpringGreen = 0x00FA9A ,
  MediumTurquoise = 0x48D1CC , MediumVioletRed = 0xC71585 , MidnightBlue = 0x191970 , MintCream = 0xF5FFFA ,
  MistyRose = 0xFFE4E1 , Moccasin = 0xFFE4B5 , NavajoWhite = 0xFFDEAD , Navy = 0x000080 ,
  OldLace = 0xFDF5E6 , Olive = 0x808000 , OliveDrab = 0x6B8E23 , Orange = 0xFFA500 ,
  OrangeRed = 0xFF4500 , Orchid = 0xDA70D6 , PaleGoldenRod = 0xEEE8AA , PaleGreen = 0x98FB98 ,
  PaleTurquoise = 0xAFEEEE , PaleVioletRed = 0xDB7093 , PapayaWhip = 0xFFEFD5 , PeachPuff = 0xFFDAB9 ,
  Peru = 0xCD853F , Pink = 0xFFC0CB , Plum = 0xDDA0DD , PowderBlue = 0xB0E0E6 ,
  Purple = 0x800080 , RebeccaPurple = 0x663399 , Red = 0xFF0000 , RosyBrown = 0xBC8F8F ,
  RoyalBlue = 0x4169E1 , SaddleBrown = 0x8B4513 , Salmon = 0xFA8072 , SandyBrown = 0xF4A460 ,
  SeaGreen = 0x2E8B57 , SeaShell = 0xFFF5EE , Sienna = 0xA0522D , Silver = 0xC0C0C0 ,
  SkyBlue = 0x87CEEB , SlateBlue = 0x6A5ACD , SlateGray = 0x708090 , Snow = 0xFFFAFA ,
  SpringGreen = 0x00FF7F , SteelBlue = 0x4682B4 , Tan = 0xD2B48C , Teal = 0x008080 ,
  Thistle = 0xD8BFD8 , Tomato = 0xFF6347 , Turquoise = 0x40E0D0 , Violet = 0xEE82EE ,
  Wheat = 0xF5DEB3 , White = 0xFFFFFF , WhiteSmoke = 0xF5F5F5 , Yellow = 0xFFFF00 ,
  YellowGreen = 0x9ACD32 , Box2DRed = 0xDC3132 , Box2DBlue = 0x30AEBF , Box2DGreen = 0x8CC924 ,
  Box2DYellow = 0xFFEE8C
}
 These colors are used for debug draw and mostly match the named SVG colors. See https://www.rapidtables.com/web/color/index.html https://johndecember.com/html/spec/colorsvg.html https://upload.wikimedia.org/wikipedia/commons/2/2b/SVG_Recognized_color_keyword_names.svg. More...
 
enum  JointType {
  Distance , Filter , Motor , Mouse ,
  Prismatic , Revolute , Weld , Wheel
}
 Joint type enumeration. More...
 
enum  ShapeType {
  Circle , Capsule , Segment , Polygon ,
  ChainSegment
}
 Shape type. More...
 
enum  TOIState {
  Unknown , Failed , Overlapped , Hit ,
  Separated
}
 Describes the TOI output. More...
 

Functions

delegate float CastResultCallback< in TContext > (Shape shape, Vec2 point, Vec2 normal, float fraction, TContext context)
 Prototype callback for ray casts.
Called for each shape found in the query. You control how the ray cast proceeds by returning a float:
 
delegate float CastResultRefCallback< TContext > (Shape shape, Vec2 point, Vec2 normal, float fraction, ref TContext context)
 Prototype callback for ray casts.
Called for each shape found in the query. You control how the ray cast proceeds by returning a float:
 
delegate float CastResultCallback (Shape shape, Vec2 point, Vec2 normal, float fraction)
 Prototype callback for ray casts.
Called for each shape found in the query. You control how the ray cast proceeds by returning a float:
 
delegate float CastResultNintCallback (Shape shape, Vec2 point, Vec2 normal, float fraction, nint context)
 Prototype callback for ray casts.
Called for each shape found in the query. You control how the ray cast proceeds by returning a float:
 
delegate bool CustomFilterCallback< in TContext > (Shape shapeA, Shape shapeB, TContext context)
 Prototype for a contact filter callback.
This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled.
Notes:
 
delegate bool CustomFilterRefCallback< TContext > (Shape shapeA, Shape shapeB, ref TContext context)
 Prototype for a contact filter callback.
This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled.
Notes:
 
delegate bool CustomFilterCallback (Shape shapeA, Shape shapeB)
 Prototype for a contact filter callback.
This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled.
Notes:
 
delegate bool CustomFilterNintCallback (Shape shapeA, Shape shapeB, nint context)
 Prototype for a contact filter callback.
This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled.
Notes:
 
delegate nint EnqueueTaskCallback (nint task, int itemCount, int minRange, nint taskContext, nint userContext)
 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 FinishTaskCallback.
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 b2TaskCallback should obey:
 
delegate void FinishTaskCallback (nint userTask, nint userContext)
 Finishes a user task object that wraps a Box2D task.
 
delegate float FrictionCallback (float frictionA, int userMaterialIdA, float frictionB, int userMaterialIdB)
 Optional friction mixing callback. This intentionally provides no context objects because this is called from a worker thread.
 
delegate bool OverlapResultNintCallback (Shape shape, nint context)
 Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

 
delegate bool OverlapResultCallback< in TContext > (Shape shape, TContext context)
 Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

 
delegate bool OverlapResultRefCallback< TContext > (Shape shape, ref TContext context)
 Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

 
delegate bool OverlapResultCallback (Shape shape)
 Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

 
delegate bool PlaneResultCallback< in TContext > (Shape shape, in PlaneResult plane, TContext context)
 Used to collect collision planes for character movers.
 
delegate bool PlaneResultRefCallback< TContext > (Shape shape, in PlaneResult plane, ref TContext context)
 Used to collect collision planes for character movers.
 
delegate bool PlaneResultCallback (Shape shape, in PlaneResult plane)
 Used to collect collision planes for character movers.
 
delegate bool PlaneResultNintCallback (Shape shape, in PlaneResult plane, nint context)
 Used to collect collision planes for character movers.
 
delegate bool PreSolveCallback< in TContext > (Shape shapeA, Shape shapeB, Manifold manifold, TContext context)
 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:
 
delegate bool PreSolveRefCallback< TContext > (Shape shapeA, Shape shapeB, Manifold manifold, ref TContext context)
 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:
 
delegate bool PreSolveNintCallback (Shape shapeA, Shape shapeB, nint manifold, nint context)
 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:
 
delegate bool PreSolveCallback (Shape shapeA, Shape shapeB, Manifold manifold)
 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:
 
delegate float RestitutionCallback (float restitutionA, int userMaterialIdA, float restitutionB, int userMaterialIdB)
 Optional restitution mixing callback. This intentionally provides no context objects because this is called from a worker thread.
 
delegate void TaskCallback (int startIndex, int endIndex, uint workerIndex, nint taskContext)
 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 EnqueueTaskCallback below. Box2D expects startIndex < endIndex and will execute a loop like this:
 
delegate bool TreeQueryCallback< in TContext > (int proxyId, uint64_t userData, TContext context)
 This function receives proxies found in the AABB query.
 
delegate bool TreeQueryRefCallback< TContext > (int proxyId, uint64_t userData, ref TContext context)
 This function receives proxies found in the AABB query.
 
delegate bool TreeQueryCallback (int proxyId, uint64_t userData)
 This function receives proxies found in the AABB query.
 
delegate bool TreeQueryNintCallback (int proxyId, uint64_t userData, nint context)
 This function receives proxies found in the AABB query.
 
delegate float TreeRayCastCallback< in TContext > (in RayCastInput input, int proxyId, uint64_t userData, TContext context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeRayCastRefCallback< TContext > (in RayCastInput input, int proxyId, uint64_t userData, ref TContext context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeRayCastCallback (in RayCastInput input, int proxyId, uint64_t userData)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeRayCastNintCallback (in RayCastInput input, int proxyId, uint64_t userData, nint context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeShapeCastCallback< in TContext > (in ShapeCastInput input, int proxyId, uint64_t userData, TContext context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeShapeCastRefCallback< TContext > (in ShapeCastInput input, int proxyId, uint64_t userData, ref TContext context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeShapeCastCallback (in ShapeCastInput input, int proxyId, uint64_t userData)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 
delegate float TreeShapeCastNintCallback (in ShapeCastInput input, int proxyId, uint64_t userData, nint context)
 This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.

 

Enumeration Type Documentation

◆ BodyType

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

Enumerator
Static 

zero mass, zero velocity, may be manually moved

Kinematic 

zero mass, velocity set by user, moved by solver

Dynamic 

positive mass, velocity determined by forces, moved by solver

◆ HexColor

enum Box2D.HexColor : uint

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.

You can cast any uint to HexColor.

Enumerator
AliceBlue 

AliceBlue: a very pale, almost white-blue (#F0F8FF).

AntiqueWhite 

AntiqueWhite: a soft, creamy off-white (#FAEBD7).

Aqua 

Aqua: a bright cyan-blue (#00FFFF).

Aquamarine 

Aquamarine: a light greenish-blue (#7FFFD4).

Azure 

Azure: a pale cyan-blue, almost white (#F0FFFF).

Beige 

Beige: a light brownish-yellow (#F5F5DC).

Bisque 

Bisque: a soft, warm peach (#FFE4C4).

Black 

Black: pure black (#000000).

BlanchedAlmond 

BlanchedAlmond: a pale almond cream (#FFEBCD).

Blue 

Blue: pure blue (#0000FF).

BlueViolet 

BlueViolet: a deep violet-blue (#8A2BE2).

Brown 

Brown: a dark reddish-brown (#A52A2A).

Burlywood 

Burlywood: a warm tan (#DEB887).

CadetBlue 

CadetBlue: a muted teal-blue (#5F9EA0).

Chartreuse 

Chartreuse: a vivid yellow-green (#7FFF00).

Chocolate 

Chocolate: a rich, dark brown (#D2691E).

Coral 

Coral: a soft pinkish-orange (#FF7F50).

CornflowerBlue 

CornflowerBlue: a medium slate-blue (#6495ED).

Cornsilk 

Cornsilk: a very pale yellow (#FFF8DC).

Crimson 

Crimson: a strong, deep red (#DC143C).

Cyan 

Cyan: pure cyan (#00FFFF).

DarkBlue 

DarkBlue: a deep blue (#00008B).

DarkCyan 

DarkCyan: a deep teal (#008B8B).

DarkGoldenRod 

DarkGoldenRod: a dark, muted gold (#B8860B).

DarkGray 

DarkGray: a medium dark gray (#A9A9A9).

DarkGreen 

DarkGreen: a deep forest green (#006400).

DarkKhaki 

DarkKhaki: an earthy, muted yellow (#BDB76B).

DarkMagenta 

DarkMagenta: a dark purple-pink (#8B008B).

DarkOliveGreen 

DarkOliveGreen: a deep olive (#556B2F).

DarkOrange 

DarkOrange: a strong burnt orange (#FF8C00).

DarkOrchid 

DarkOrchid: a rich purple (#9932CC).

DarkRed 

DarkRed: a deep crimson (#8B0000).

DarkSalmon 

DarkSalmon: a muted pinkish-orange (#E9967A).

DarkSeaGreen 

DarkSeaGreen: a soft, gray-green (#8FBC8F).

DarkSlateBlue 

DarkSlateBlue: a deep slate-purple (#483D8B).

DarkSlateGray 

DarkSlateGray: a dark gray-green (#2F4F4F).

DarkTurquoise 

DarkTurquoise: a bright teal (#00CED1).

DarkViolet 

DarkViolet: a deep violet (#9400D3).

DeepPink 

DeepPink: a vivid pink (#FF1493).

DeepSkyBlue 

DeepSkyBlue: a bright sky-blue (#00BFFF).

DimGray 

DimGray: a dark gray (#696969).

DodgerBlue 

DodgerBlue: a vibrant medium blue (#1E90FF).

FireBrick 

FireBrick: a strong brick-red (#B22222).

FloralWhite 

FloralWhite: a soft off-white with a hint of pink (#FFFAF0).

ForestGreen 

ForestGreen: a deep pine green (#228B22).

Fuchsia 

Fuchsia: pure magenta (#FF00FF).

Gainsboro 

Gainsboro: a very light gray (#DCDCDC).

GhostWhite 

GhostWhite: a very pale gray-blue (#F8F8FF).

Gold 

Gold: a bright metallic gold (#FFD700).

GoldenRod 

GoldenRod: a muted gold (#DAA520).

Gray 

Gray: a medium gray (#808080).

Green 

Green: pure green (#008000).

GreenYellow 

GreenYellow: a bright yellow-green (#ADFF2F).

HoneyDew 

HoneyDew: a pale mint-green (#F0FFF0).

HotPink 

HotPink: a vivid pink (#FF69B4).

IndianRed 

IndianRed: a muted, earthy red (#CD5C5C).

Indigo 

Indigo: a deep blue-purple (#4B0082).

Ivory 

Ivory: a creamy off-white (#FFFFF0).

Khaki 

Khaki: a warm sandy beige (#F0E68C).

Lavender 

Lavender: a pale purple (#E6E6FA).

LavenderBlush 

LavenderBlush: an off-white with a hint of pink (#FFF0F5).

LawnGreen 

LawnGreen: a bright, vivid green (#7CFC00).

LemonChiffon 

LemonChiffon: a pale yellow with a hint of cream (#FFFACD).

LightBlue 

LightBlue: a soft, pale blue (#ADD8E6).

LightCoral 

LightCoral: a gentle pinkish-red (#F08080).

LightCyan 

LightCyan: a very pale cyan (#E0FFFF).

LightGoldenRodYellow 

LightGoldenRodYellow: a pale, warm yellow (#FAFAD2).

LightGray 

LightGray: a soft light gray (#D3D3D3).

LightGreen 

LightGreen: a soft pastel green (#90EE90).

LightPink 

LightPink: a gentle pink (#FFB6C1).

LightSalmon 

LightSalmon: a soft peach-pink (#FFA07A).

LightSeaGreen 

LightSeaGreen: a medium teal (#20B2AA).

LightSkyBlue 

LightSkyBlue: a pale sky-blue (#87CEFA).

LightSlateGray 

LightSlateGray: a muted gray-blue (#778899).

LightSteelBlue 

LightSteelBlue: a soft, muted blue (#B0C4DE).

LightYellow 

LightYellow: a very pale yellow (#FFFFE0).

Lime 

Lime: pure lime green (#00FF00).

LimeGreen 

LimeGreen: a medium bright green (#32CD32).

Linen 

Linen: a soft off-white with a hint of beige (#FAF0E6).

Magenta 

Magenta: pure magenta (#FF00FF).

Maroon 

Maroon: a dark reddish-brown (#800000).

MediumAquaMarine 

MediumAquaMarine: a muted aquamarine (#66CDAA).

MediumBlue 

MediumBlue: a moderate blue (#0000CD).

MediumOrchid 

MediumOrchid: a medium purple-pink (#BA55D3).

MediumPurple 

MediumPurple: a moderate lavender (#9370DB).

MediumSeaGreen 

MediumSeaGreen: a subdued green (#3CB371).

MediumSlateBlue 

MediumSlateBlue: a medium slate-purple (#7B68EE).

MediumSpringGreen 

MediumSpringGreen: a bright spring green (#00FA9A).

MediumTurquoise 

MediumTurquoise: a bright turquoise (#48D1CC).

MediumVioletRed 

MediumVioletRed: a deep pinkish-red (#C71585).

MidnightBlue 

MidnightBlue: a very dark blue (#191970).

MintCream 

MintCream: a very pale mint (#F5FFFA).

MistyRose 

MistyRose: a soft pinkish-white (#FFE4E1).

Moccasin 

Moccasin: a light peach (#FFE4B5).

NavajoWhite 

NavajoWhite: a warm cream (#FFDEAD).

Navy 

Navy: a very dark blue (#000080).

OldLace 

OldLace: a soft off-white with a slight yellow tint (#FDF5E6).

Olive 

Olive: a dark yellow-green (#808000).

OliveDrab 

OliveDrab: a muted olive green (#6B8E23).

Orange 

Orange: a bright, vivid orange (#FFA500).

OrangeRed 

OrangeRed: a strong reddish-orange (#FF4500).

Orchid 

Orchid: a soft purple-pink (#DA70D6).

PaleGoldenRod 

PaleGoldenRod: a very soft gold (#EEE8AA).

PaleGreen 

PaleGreen: a soft pastel green (#98FB98).

PaleTurquoise 

PaleTurquoise: a delicate cyan (#AFEEEE).

PaleVioletRed 

PaleVioletRed: a muted rose (#DB7093).

PapayaWhip 

PapayaWhip: a pale peach (#FFEFD5).

PeachPuff 

PeachPuff: a soft peach-pink (#FFDAB9).

Peru 

Peru: a warm medium brown (#CD853F).

Pink 

Pink: a light true pink (#FFC0CB).

Plum 

Plum: a soft purple (#DDA0DD).

PowderBlue 

PowderBlue: a pale bluish-gray (#B0E0E6).

Purple 

Purple: a deep magenta-purple (#800080).

RebeccaPurple 

RebeccaPurple: a dusky purple (#663399).

Red 

Red: pure red (#FF0000).

RosyBrown 

RosyBrown: a muted pink-brown (#BC8F8F).

RoyalBlue 

RoyalBlue: a bright, deep blue (#4169E1).

SaddleBrown 

SaddleBrown: a rich brown (#8B4513).

Salmon 

Salmon: a soft pink (#FA8072).

SandyBrown 

SandyBrown: a warm light brown (#F4A460).

SeaGreen 

SeaGreen: a deep green (#2E8B57).

SeaShell 

SeaShell: a soft off-white (#FFF5EE).

Sienna 

Sienna: a rich reddish-brown (#A0522D).

Silver 

Silver: a light metallic gray (#C0C0C0).

SkyBlue 

SkyBlue: a light sky-blue (#87CEEB).

SlateBlue 

SlateBlue: a muted purple-blue (#6A5ACD).

SlateGray 

SlateGray: a medium gray with blue tint (#708090).

Snow 

Snow: a crisp white (#FFFAFA).

SpringGreen 

SpringGreen: a bright green (#00FF7F).

SteelBlue 

SteelBlue: a cool steely blue (#4682B4).

Tan 

Tan: a pale brown (#D2B48C).

Teal 

Teal: a dark cyan (#008080).

Thistle 

Thistle: a pale lavender-gray (#D8BFD8).

Tomato 

Tomato: a vibrant red-orange (#FF6347).

Turquoise 

Turquoise: a bright cyan-green (#40E0D0).

Violet 

Violet: a light purple (#EE82EE).

Wheat 

Wheat: a soft, warm beige (#F5DEB3).

White 

White: pure white (#FFFFFF).

WhiteSmoke 

WhiteSmoke: a very light gray (#F5F5F5).

Yellow 

Yellow: pure yellow (#FFFF00).

YellowGreen 

YellowGreen: a soft yellow-green (#9ACD32).

Box2DRed 

Box2DRed: a vivid red used in Box2D debug draw (#DC3132).

Box2DBlue 

Box2DBlue: a bright blue used in Box2D debug draw (#30AEBF).

Box2DGreen 

Box2DGreen: a bright green used in Box2D debug draw (#8CC924).

Box2DYellow 

Box2DYellow: a soft yellow used in Box2D debug draw (#FFEE8C).

◆ JointType

Joint type enumeration.

Enumerator
Distance 

Distance joint.

Filter 

Filter joint.

Motor 

Motor joint.

Mouse 

Mouse joint.

Prismatic 

Prismatic joint.

Revolute 

Revolute joint.

Weld 

Weld joint.

Wheel 

Wheel joint.

◆ ShapeType

Shape type.

Enumerator
Circle 

A circle with an offset.

Capsule 

A capsule is an extruded circle.

Segment 

A line segment.

Polygon 

A convex polygon.

ChainSegment 

A line segment owned by a chain shape.

◆ TOIState

Describes the TOI output.

Enumerator
Unknown 

Unknown state.

Failed 

Failed state.

Overlapped 

Overlapped state.

Hit 

Hit state.

Separated 

Separated state.

◆ TreeNodeFlags

enum Box2D.TreeNodeFlags : ushort

Flags for a TreeNode.

Enumerator
AllocatedNode 

The node is allocated.

EnlargedNode 

The node is enlarged.

LeafNode 

The node is a leaf node.

Function Documentation

◆ CastResultCallback()

delegate float Box2D.CastResultCallback ( Shape  shape,
Vec2  point,
Vec2  normal,
float  fraction 
)

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

  • return -1: ignore this shape and continue
  • return 0: terminate the ray cast
  • return fraction: clip the ray to this point
  • return 1: don't clip the ray and continue
Parameters
shapeThe Shape
pointThe point of initial intersection
normalThe normal vector at the point of intersection
fractionThe fraction along the ray at the point of intersection
Returns
-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue

◆ CastResultCallback< in TContext >()

delegate float Box2D.CastResultCallback< in TContext > ( Shape  shape,
Vec2  point,
Vec2  normal,
float  fraction,
TContext  context 
)

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

  • return -1: ignore this shape and continue
  • return 0: terminate the ray cast
  • return fraction: clip the ray to this point
  • return 1: don't clip the ray and continue
Parameters
shapeThe Shape
pointThe point of initial intersection
normalThe normal vector at the point of intersection
fractionThe fraction along the ray at the point of intersection
contextThe user context
Returns
-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue
Type Constraints
TContext :class 

◆ CastResultNintCallback()

delegate float Box2D.CastResultNintCallback ( Shape  shape,
Vec2  point,
Vec2  normal,
float  fraction,
nint  context 
)

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

  • return -1: ignore this shape and continue
  • return 0: terminate the ray cast
  • return fraction: clip the ray to this point
  • return 1: don't clip the ray and continue
Parameters
shapeThe Shape
pointThe point of initial intersection
normalThe normal vector at the point of intersection
fractionThe fraction along the ray at the point of intersection
contextThe user context
Returns
-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue

◆ CastResultRefCallback< TContext >()

delegate float Box2D.CastResultRefCallback< TContext > ( Shape  shape,
Vec2  point,
Vec2  normal,
float  fraction,
ref TContext  context 
)

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

  • return -1: ignore this shape and continue
  • return 0: terminate the ray cast
  • return fraction: clip the ray to this point
  • return 1: don't clip the ray and continue
Parameters
shapeThe Shape
pointThe point of initial intersection
normalThe normal vector at the point of intersection
fractionThe fraction along the ray at the point of intersection
contextThe user context
Returns
-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue
Type Constraints
TContext :unmanaged 

◆ CustomFilterCallback()

delegate bool Box2D.CustomFilterCallback ( Shape  shapeA,
Shape  shapeB 
)

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

  • this function must be thread-safe
  • this is only called if one of the two shapes has enabled custom filtering
  • this 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

Parameters
shapeAThe first shape
shapeBThe second shape
Returns
true if the collision should be enabled, false otherwise

◆ CustomFilterCallback< in TContext >()

delegate bool Box2D.CustomFilterCallback< in TContext > ( Shape  shapeA,
Shape  shapeB,
TContext  context 
)

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

  • this function must be thread-safe
  • this is only called if one of the two shapes has enabled custom filtering
  • this 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

Parameters
shapeAThe first shape
shapeBThe second shape
contextThe user context
Returns
true if the collision should be enabled, false otherwise
Type Constraints
TContext :class 

◆ CustomFilterNintCallback()

delegate bool Box2D.CustomFilterNintCallback ( Shape  shapeA,
Shape  shapeB,
nint  context 
)

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

  • this function must be thread-safe
  • this is only called if one of the two shapes has enabled custom filtering
  • this 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

Parameters
shapeAThe first shape
shapeBThe second shape
contextThe user context
Returns
true if the collision should be enabled, false otherwise

◆ CustomFilterRefCallback< TContext >()

delegate bool Box2D.CustomFilterRefCallback< TContext > ( Shape  shapeA,
Shape  shapeB,
ref TContext  context 
)

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

  • this function must be thread-safe
  • this is only called if one of the two shapes has enabled custom filtering
  • this 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

Parameters
shapeAThe first shape
shapeBThe second shape
contextThe user context
Returns
true if the collision should be enabled, false otherwise
Type Constraints
TContext :unmanaged 

◆ EnqueueTaskCallback()

delegate nint Box2D.EnqueueTaskCallback ( nint  task,
int  itemCount,
int  minRange,
nint  taskContext,
nint  userContext 
)

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 FinishTaskCallback.
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 b2TaskCallback should obey:

endIndex - startIndex >= minRange
The exception of course is when itemCount < minRange.

Parameters
taskThe task callback
itemCountThe number of Box2D work items
minRangeThe minimum range
taskContextThe task context
userContextThe user context
Returns
A pointer to the user's task object

task is passed as a nint because the CLR will otherwise keep calling Marshal.GetDelegateForFunctionPointer, causing heap allocations. On the Box2D side, it's a consistent void* pointer, so we can cache it. See Parallelism.DefaultEnqueue source for how we handle this.

◆ FinishTaskCallback()

delegate void Box2D.FinishTaskCallback ( nint  userTask,
nint  userContext 
)

Finishes a user task object that wraps a Box2D task.

Parameters
userTaskThe user task
userContextThe user context

◆ FrictionCallback()

delegate float Box2D.FrictionCallback ( float  frictionA,
int  userMaterialIdA,
float  frictionB,
int  userMaterialIdB 
)

Optional friction mixing callback. This intentionally provides no context objects because this is called from a worker thread.

Parameters
frictionAThe friction A
userMaterialIdAThe material A
frictionBThe friction B
userMaterialIdBThe material B
Returns
The mixed friction

◆ OverlapResultCallback()

delegate bool Box2D.OverlapResultCallback ( Shape  shape)

Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

Parameters
shapeThe Shape
Returns
true to continue the query, false to terminate

◆ OverlapResultCallback< in TContext >()

delegate bool Box2D.OverlapResultCallback< in TContext > ( Shape  shape,
TContext  context 
)

Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

Parameters
shapeThe Shape
contextThe context
Returns
true to continue the query, false to terminate
Type Constraints
TContext :class 

◆ OverlapResultNintCallback()

delegate bool Box2D.OverlapResultNintCallback ( Shape  shape,
nint  context 
)

Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

Parameters
shapeThe Shape
contextThe context
Returns
true to continue the query, false to terminate

◆ OverlapResultRefCallback< TContext >()

delegate bool Box2D.OverlapResultRefCallback< TContext > ( Shape  shape,
ref TContext  context 
)

Prototype callback for overlap queries.
Called for each shape found in the query.
Return false to terminate the query.

Parameters
shapeThe Shape
contextThe context
Returns
true to continue the query, false to terminate
Type Constraints
TContext :unmanaged 

◆ PlaneResultCallback()

delegate bool Box2D.PlaneResultCallback ( Shape  shape,
in PlaneResult  plane 
)

Used to collect collision planes for character movers.

Parameters
shapeThe shape
planeThe plane
Returns
True to continue gathering planes

◆ PlaneResultCallback< in TContext >()

delegate bool Box2D.PlaneResultCallback< in TContext > ( Shape  shape,
in PlaneResult  plane,
TContext  context 
)

Used to collect collision planes for character movers.

Parameters
shapeThe shape
planeThe plane
contextThe user context
Returns
True to continue gathering planes
Type Constraints
TContext :class 

◆ PlaneResultNintCallback()

delegate bool Box2D.PlaneResultNintCallback ( Shape  shape,
in PlaneResult  plane,
nint  context 
)

Used to collect collision planes for character movers.

Parameters
shapeThe shape
planeThe plane
contextThe user context
Returns
True to continue gathering planes

◆ PlaneResultRefCallback< TContext >()

delegate bool Box2D.PlaneResultRefCallback< TContext > ( Shape  shape,
in PlaneResult  plane,
ref TContext  context 
)

Used to collect collision planes for character movers.

Parameters
shapeThe shape
planeThe plane
contextThe user context
Returns
True to continue gathering planes
Type Constraints
TContext :unmanaged 

◆ PreSolveCallback()

delegate bool Box2D.PreSolveCallback ( Shape  shapeA,
Shape  shapeB,
Manifold  manifold 
)

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

Parameters
shapeAThe first Shape
shapeBThe second Shape
manifoldThe manifold
Returns
true if the contact should be enabled, false otherwise

◆ PreSolveCallback< in TContext >()

delegate bool Box2D.PreSolveCallback< in TContext > ( Shape  shapeA,
Shape  shapeB,
Manifold  manifold,
TContext  context 
)

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

Parameters
shapeAThe first Shape
shapeBThe second Shape
manifoldThe manifold
contextThe context
Returns
true if the contact should be enabled, false otherwise
Type Constraints
TContext :class 

◆ PreSolveNintCallback()

delegate bool Box2D.PreSolveNintCallback ( Shape  shapeA,
Shape  shapeB,
nint  manifold,
nint  context 
)

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

Parameters
shapeAThe first Shape
shapeBThe second Shape
manifoldThe manifold
contextThe context
Returns
true if the contact should be enabled, false otherwise

◆ PreSolveRefCallback< TContext >()

delegate bool Box2D.PreSolveRefCallback< TContext > ( Shape  shapeA,
Shape  shapeB,
Manifold  manifold,
ref TContext  context 
)

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

Parameters
shapeAThe first Shape
shapeBThe second Shape
manifoldThe manifold
contextThe context
Returns
true if the contact should be enabled, false otherwise
Type Constraints
TContext :unmanaged 

◆ RestitutionCallback()

delegate float Box2D.RestitutionCallback ( float  restitutionA,
int  userMaterialIdA,
float  restitutionB,
int  userMaterialIdB 
)

Optional restitution mixing callback. This intentionally provides no context objects because this is called from a worker thread.

Parameters
restitutionAThe restitution A
userMaterialIdAThe material A
restitutionBThe restitution B
userMaterialIdBThe material B
Returns
The mixed restitution

◆ TaskCallback()

delegate void Box2D.TaskCallback ( int  startIndex,
int  endIndex,
uint  workerIndex,
nint  taskContext 
)

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 EnqueueTaskCallback below. Box2D expects startIndex < endIndex and will execute a loop like this:

for (int i = startIndex; i < endIndex; ++i)
{
DoWork();
}

Parameters
startIndexThe start index of the task
endIndexThe end index of the task
workerIndexThe worker index
taskContextThe task context

◆ TreeQueryCallback()

delegate bool Box2D.TreeQueryCallback ( int  proxyId,
uint64_t  userData 
)

This function receives proxies found in the AABB query.

Returns
True if the query should continue

◆ TreeQueryCallback< in TContext >()

delegate bool Box2D.TreeQueryCallback< in TContext > ( int  proxyId,
uint64_t  userData,
TContext  context 
)

This function receives proxies found in the AABB query.

Returns
True if the query should continue
Type Constraints
TContext :class 

◆ TreeQueryNintCallback()

delegate bool Box2D.TreeQueryNintCallback ( int  proxyId,
uint64_t  userData,
nint  context 
)

This function receives proxies found in the AABB query.

Returns
True if the query should continue

◆ TreeQueryRefCallback< TContext >()

delegate bool Box2D.TreeQueryRefCallback< TContext > ( int  proxyId,
uint64_t  userData,
ref TContext  context 
)

This function receives proxies found in the AABB query.

Returns
True if the query should continue
Type Constraints
TContext :unmanaged 

◆ TreeRayCastCallback()

delegate float Box2D.TreeRayCastCallback ( in RayCastInput  input,
int  proxyId,
uint64_t  userData 
)

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
Returns
Ray cast input

◆ TreeRayCastCallback< in TContext >()

delegate float Box2D.TreeRayCastCallback< in TContext > ( in RayCastInput  input,
int  proxyId,
uint64_t  userData,
TContext  context 
)

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
Returns
Ray cast input
Type Constraints
TContext :class 

◆ TreeRayCastNintCallback()

delegate float Box2D.TreeRayCastNintCallback ( in RayCastInput  input,
int  proxyId,
uint64_t  userData,
nint  context 
)

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
Returns
Ray cast input

◆ TreeRayCastRefCallback< TContext >()

delegate float Box2D.TreeRayCastRefCallback< TContext > ( in RayCastInput  input,
int  proxyId,
uint64_t  userData,
ref TContext  context 
)

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
Returns
Ray cast input
Type Constraints
TContext :unmanaged 

◆ TreeShapeCastCallback()

delegate float Box2D.TreeShapeCastCallback ( in ShapeCastInput  input,
int  proxyId,
uint64_t  userData 
)

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
Returns
Ray cast input

◆ TreeShapeCastCallback< in TContext >()

delegate float Box2D.TreeShapeCastCallback< in TContext > ( in ShapeCastInput  input,
int  proxyId,
uint64_t  userData,
TContext  context 
)

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
Returns
Ray cast input
Type Constraints
TContext :class 

◆ TreeShapeCastNintCallback()

delegate float Box2D.TreeShapeCastNintCallback ( in ShapeCastInput  input,
int  proxyId,
uint64_t  userData,
nint  context 
)

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
Returns
Ray cast input

◆ TreeShapeCastRefCallback< TContext >()

delegate float Box2D.TreeShapeCastRefCallback< TContext > ( in ShapeCastInput  input,
int  proxyId,
uint64_t  userData,
ref TContext  context 
)

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
Returns
Ray cast input
Type Constraints
TContext :unmanaged