1- // Generated by Box2dNetGen for Box2D v3 on 02/ 11/2025 15:17:57
1+ // Generated by Box2dNetGen for Box2D v3 on 11/01/2026 07:32:50
22
33using System . Runtime . InteropServices ;
44using System . Numerics ;
@@ -404,10 +404,14 @@ public enum b2HexColor
404404 /// <returns>Original C type: void</returns>
405405 /// <param name="mem">the memory previously allocated through `b2AllocFcn`
406406 /// (Original C type: void*)</param>
407+ /// <param name="size">the allocation size in bytes
408+ /// (Original C type: unsigned int)</param>
407409 /// <param name="mem">the memory previously allocated through `b2AllocFcn`
408410 /// (Original C type: void*)</param>
411+ /// <param name="size">the allocation size in bytes
412+ /// (Original C type: unsigned int)</param>
409413 [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
410- public delegate void b2FreeFcn ( IntPtr /* void* */ mem ) ;
414+ public delegate void b2FreeFcn ( IntPtr /* void* */ mem , uint size ) ;
411415
412416 /// <summary>
413417 /// Prototype for the user assert callback. Return 0 to skip the debugger break.
@@ -419,6 +423,14 @@ public enum b2HexColor
419423 [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
420424 public delegate int b2AssertFcn ( string condition , string fileName , int lineNumber ) ;
421425
426+ /// <summary>
427+ /// Prototype for user log callback. Used to log warnings.
428+ /// </summary>
429+ /// <returns>Original C type: void</returns>
430+ /// <param name="message">(Original C type: const char*)</param>
431+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
432+ public delegate void b2LogFcn ( string message ) ;
433+
422434 /// <summary>
423435 /// This function receives proxies found in the AABB query.
424436 /// @return true if the query should continue
@@ -1687,6 +1699,8 @@ public partial struct b2ManifoldPoint
16871699 /// <summary>
16881700 /// The total normal impulse applied across sub-stepping and restitution. This is important
16891701 /// to identify speculative contact points that had an interaction in the time step.
1702+ /// This includes the warm starting impulse, the sub-step delta impulse, and the restitution
1703+ /// impulse.
16901704 /// </summary>
16911705 /// <returns>Original C type: float</returns>
16921706 public float totalNormalImpulse ;
@@ -2469,10 +2483,20 @@ public partial struct b2BodyDef
24692483 public bool isAwake ;
24702484
24712485 /// <summary>
2472- /// Treat this body as high speed object that performs continuous collision detection
2486+ /// Treat this body as a high speed object that performs continuous collision detection
24732487 /// against dynamic and kinematic bodies, but not other bullet bodies.
24742488 /// @warning Bullets should be used sparingly. They are not a solution for general dynamic-versus-dynamic
2475- /// continuous collision.
2489+ /// continuous collision. They do not guarantee accurate collision if both bodies are fast moving because
2490+ /// the bullet does a continuous check after all non-bullet bodies have moved. You could get unlucky and have
2491+ /// the bullet body end a time step very close to a non-bullet body and the non-bullet body then moves over
2492+ /// the bullet body. In continuous collision, initial overlap is ignored to avoid freezing bodies in place.
2493+ /// I do not recommend using them for game projectiles if precise collision timing is needed. Instead consider
2494+ /// using a ray or shape cast. You can use a marching ray or shape cast for projectile that moves over time.
2495+ /// If you want a fast moving projectile to collide with a fast moving target, you need to consider the relative
2496+ /// movement in your ray or shape cast. This is out of the scope of Box2D.
2497+ /// So what are good use cases for bullets? Pinball games or games with dynamic containers that hold other objects.
2498+ /// It should be a use case where it doesn't break the game if there is a collision missed, but the having them
2499+ /// captured improves the quality of the game.
24762500 /// </summary>
24772501 /// <returns>Original C type: bool</returns>
24782502 [ MarshalAs ( UnmanagedType . U1 ) ]
@@ -2742,6 +2766,7 @@ public partial struct b2ShapeDef
27422766
27432767 /// <summary>
27442768 /// Should the body update the mass properties when this shape is created. Default is true.
2769+ /// Warning: if this is true, you MUST call b2Body_ApplyMassFromShapes before simulating the world.
27452770 /// </summary>
27462771 /// <returns>Original C type: bool</returns>
27472772 [ MarshalAs ( UnmanagedType . U1 ) ]
@@ -2801,7 +2826,8 @@ public partial struct b2ChainDef
28012826
28022827 /// <summary>
28032828 /// The material count. Must be 1 or count. This allows you to provide one
2804- /// material for all segments or a unique material per segment.
2829+ /// material for all segments or a unique material per segment. For open
2830+ /// chains, the material on the ghost segments are place holders.
28052831 /// </summary>
28062832 /// <returns>Original C type: int</returns>
28072833 public int materialCount ;
@@ -3174,13 +3200,13 @@ public partial struct b2DistanceJointDef
31743200 public bool enableLimit ;
31753201
31763202 /// <summary>
3177- /// Minimum length. Clamped to a stable minimum value.
3203+ /// Minimum length for limit . Clamped to a stable minimum value.
31783204 /// </summary>
31793205 /// <returns>Original C type: float</returns>
31803206 public float minLength ;
31813207
31823208 /// <summary>
3183- /// Maximum length. Must be greater than or equal to the minimum length.
3209+ /// Maximum length for limit . Must be greater than or equal to the minimum length.
31843210 /// </summary>
31853211 /// <returns>Original C type: float</returns>
31863212 public float maxLength ;
@@ -3860,6 +3886,14 @@ public partial struct b2ContactHitEvent
38603886 /// <returns>Original C type: b2ShapeId</returns>
38613887 public b2ShapeId shapeIdB ;
38623888
3889+ /// <summary>
3890+ /// Id of the contact.
3891+ /// @warning this contact may have been destroyed
3892+ /// @see b2Contact_IsValid
3893+ /// </summary>
3894+ /// <returns>Original C type: b2ContactId</returns>
3895+ public b2ContactId contactId ;
3896+
38633897 /// <summary>
38643898 /// Point where the shapes hit at the beginning of the time step.
38653899 /// This is a mid-point between the two surfaces. It could be at speculative
@@ -3880,10 +3914,11 @@ public partial struct b2ContactHitEvent
38803914 /// <returns>Original C type: float</returns>
38813915 public float approachSpeed ;
38823916
3883- public b2ContactHitEvent ( in b2ShapeId shapeIdA , in b2ShapeId shapeIdB , in Vector2 point , in Vector2 normal , in float approachSpeed )
3917+ public b2ContactHitEvent ( in b2ShapeId shapeIdA , in b2ShapeId shapeIdB , in b2ContactId contactId , in Vector2 point , in Vector2 normal , in float approachSpeed )
38843918 {
38853919 this . shapeIdA = shapeIdA ;
38863920 this . shapeIdB = shapeIdB ;
3921+ this . contactId = contactId ;
38873922 this . point = point ;
38883923 this . normal = normal ;
38893924 this . approachSpeed = approachSpeed ;
@@ -4170,7 +4205,7 @@ public static void b2SetAllocator(b2AllocFcn allocFcn, b2FreeFcn freeFcn)
41704205public static extern int b2GetByteCount ( ) ;
41714206
41724207 /// <summary>
4173- /// Override the default assert callback
4208+ /// Override the default assert function
41744209 /// </summary>
41754210 /// <returns>Original C type: void</returns>
41764211 /// <param name="assertFcn">a non-null assert callback
@@ -4181,7 +4216,7 @@ public static void b2SetAllocator(b2AllocFcn allocFcn, b2FreeFcn freeFcn)
41814216public static extern void b2SetAssertFcn ( IntPtr assertFcn ) ;
41824217
41834218 /// <summary>
4184- /// Override the default assert callback
4219+ /// Override the default assert function
41854220 /// </summary>
41864221 /// <returns>Original C type: void</returns>
41874222 /// <param name="assertFcn">a non-null assert callback
@@ -4193,6 +4228,30 @@ public static void b2SetAssertFcn(b2AssertFcn assertFcn)
41934228 b2SetAssertFcn ( Marshal . GetFunctionPointerForDelegate ( assertFcn ) ) ;
41944229}
41954230
4231+ /// <summary>
4232+ /// Override the default log function
4233+ /// </summary>
4234+ /// <returns>Original C type: void</returns>
4235+ /// <param name="logFcn">a non-null log callback
4236+ /// (Original C type: b2LogFcn*)</param>
4237+ /// <param name="logFcn">a non-null log callback
4238+ /// (Original C type: b2LogFcn*)</param>
4239+ [ DllImport ( Box2DLibrary , CallingConvention = CallingConvention . Cdecl ) ]
4240+ public static extern void b2SetLogFcn ( IntPtr logFcn ) ;
4241+
4242+ /// <summary>
4243+ /// Override the default log function
4244+ /// </summary>
4245+ /// <returns>Original C type: void</returns>
4246+ /// <param name="logFcn">a non-null log callback
4247+ /// (Original C type: b2LogFcn*)</param>
4248+ /// <param name="logFcn">a non-null log callback
4249+ /// (Original C type: b2LogFcn*)</param>
4250+ public static void b2SetLogFcn ( b2LogFcn logFcn )
4251+ {
4252+ b2SetLogFcn ( Marshal . GetFunctionPointerForDelegate ( logFcn ) ) ;
4253+ }
4254+
41964255 /// <summary>
41974256 /// Get the current version of Box2D
41984257 /// </summary>
@@ -5032,15 +5091,28 @@ public static void b2World_SetRestitutionCallback(b2WorldId worldId, b2Restituti
50325091 /// <summary>
50335092 /// Set the velocity to reach the given transform after a given time step.
50345093 /// The result will be close but maybe not exact. This is meant for kinematic bodies.
5035- /// The target is not applied if the velocity would be below the sleep threshold.
5036- /// This will automatically wake the body if asleep.
5094+ /// The target is not applied if the velocity would be below the sleep threshold and
5095+ /// the body is currently asleep.
50375096 /// </summary>
50385097 /// <returns>Original C type: void</returns>
5039- /// <param name="bodyId">(Original C type: b2BodyId)</param>
5040- /// <param name="target">(Original C type: b2Transform)</param>
5041- /// <param name="timeStep">(Original C type: float)</param>
5098+ /// <param name="bodyId">The body id
5099+ /// (Original C type: b2BodyId)</param>
5100+ /// <param name="target">The target transform for the body
5101+ /// (Original C type: b2Transform)</param>
5102+ /// <param name="timeStep">The time step of the next call to b2World_Step
5103+ /// (Original C type: float)</param>
5104+ /// <param name="wake">Option to wake the body or not
5105+ /// (Original C type: bool)</param>
5106+ /// <param name="bodyId">The body id
5107+ /// (Original C type: b2BodyId)</param>
5108+ /// <param name="target">The target transform for the body
5109+ /// (Original C type: b2Transform)</param>
5110+ /// <param name="timeStep">The time step of the next call to b2World_Step
5111+ /// (Original C type: float)</param>
5112+ /// <param name="wake">Option to wake the body or not
5113+ /// (Original C type: bool)</param>
50425114[ DllImport ( Box2DLibrary , CallingConvention = CallingConvention . Cdecl ) ]
5043- public static extern void b2Body_SetTargetTransform ( b2BodyId bodyId , b2Transform target , float timeStep ) ;
5115+ public static extern void b2Body_SetTargetTransform ( b2BodyId bodyId , b2Transform target , float timeStep , [ MarshalAs ( UnmanagedType . U1 ) ] bool wake ) ;
50445116
50455117 /// <summary>
50465118 /// Get the linear velocity of a local point attached to a body. Usually in meters per second.
@@ -5125,6 +5197,19 @@ public static void b2World_SetRestitutionCallback(b2WorldId worldId, b2Restituti
51255197[ DllImport ( Box2DLibrary , CallingConvention = CallingConvention . Cdecl ) ]
51265198public static extern void b2Body_ApplyTorque ( b2BodyId bodyId , float torque , [ MarshalAs ( UnmanagedType . U1 ) ] bool wake ) ;
51275199
5200+ /// <summary>
5201+ /// Clear the force and torque on this body. Forces and torques are automatically cleared after each world
5202+ /// step. So this only needs to be called if the application wants to remove the effect of previous
5203+ /// calls to apply forces and torques before the world step is called.
5204+ /// </summary>
5205+ /// <returns>Original C type: void</returns>
5206+ /// <param name="bodyId">The body id
5207+ /// (Original C type: b2BodyId)</param>
5208+ /// <param name="bodyId">The body id
5209+ /// (Original C type: b2BodyId)</param>
5210+ [ DllImport ( Box2DLibrary , CallingConvention = CallingConvention . Cdecl ) ]
5211+ public static extern void b2Body_ClearForces ( b2BodyId bodyId ) ;
5212+
51285213 /// <summary>
51295214 /// Apply an impulse at a point. This immediately modifies the velocity.
51305215 /// It also modifies the angular velocity if the point of application
@@ -5557,7 +5642,7 @@ public static void b2World_SetRestitutionCallback(b2WorldId worldId, b2Restituti
55575642 /// <summary>
55585643 /// Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned.
55595644 /// Contacts are not created until the next time step.
5560- /// @return the shape id for accessing the shape
5645+ /// @return the shape id for accessing the shape, this will be b2_nullShapeId if the length is too small.
55615646 /// </summary>
55625647 /// <returns>Original C type: b2ShapeId</returns>
55635648 /// <param name="bodyId">(Original C type: b2BodyId)</param>
0 commit comments