@@ -346,9 +346,11 @@ typedef struct b2ShapeDef
346346 float restitution ;
347347
348348 /// The rolling resistance usually in the range [0,1].
349- /// todo
350349 float rollingResistance ;
351350
351+ /// The tangent speed for conveyor belts
352+ float tangentSpeed ;
353+
352354 /// User material identifier. This is passed with query results and to friction and restitution
353355 /// combining functions. It is not used internally.
354356 int material ;
@@ -394,6 +396,35 @@ typedef struct b2ShapeDef
394396/// @ingroup shape
395397B2_API b2ShapeDef b2DefaultShapeDef ( void );
396398
399+ /// Surface materials allow chain shapes to have per segment surface properties.
400+ /// @ingroup shape
401+ typedef struct b2SurfaceMaterial
402+ {
403+ /// The Coulomb (dry) friction coefficient, usually in the range [0,1].
404+ float friction ;
405+
406+ /// The coefficient of restitution (bounce) usually in the range [0,1].
407+ /// https://en.wikipedia.org/wiki/Coefficient_of_restitution
408+ float restitution ;
409+
410+ /// The rolling resistance usually in the range [0,1].
411+ float rollingResistance ;
412+
413+ /// The tangent speed for conveyor belts
414+ float tangentSpeed ;
415+
416+ /// User material identifier. This is passed with query results and to friction and restitution
417+ /// combining functions. It is not used internally.
418+ int material ;
419+
420+ /// Custom debug draw color.
421+ uint32_t customColor ;
422+ } b2SurfaceMaterial ;
423+
424+ /// Use this to initialize your surface material
425+ /// @ingroup shape
426+ B2_API b2SurfaceMaterial b2DefaultSurfaceMaterial ( void );
427+
397428/// Used to create a chain of line segments. This is designed to eliminate ghost collisions with some limitations.
398429/// - chains are one-sided
399430/// - chains have no mass and should be used on static bodies
@@ -420,28 +451,19 @@ typedef struct b2ChainDef
420451 /// The point count, must be 4 or more.
421452 int count ;
422453
423- /// The friction coefficient, usually in the range [0,1].
424- float friction ;
425-
426- /// The restitution (elasticity) usually in the range [0,1].
427- float restitution ;
454+ /// Surface materials for each segment. These are cloned.
455+ const b2SurfaceMaterial * materials ;
428456
429- /// User material identifier. This is passed with query results and to friction and restitution
430- /// combining functions. It is not used internally .
431- int material ;
457+ /// The material count. Must be 1 or count. This allows you to provide one
458+ /// material for all segments or a unique material per segment .
459+ int materialCount ;
432460
433461 /// Contact filtering data.
434462 b2Filter filter ;
435463
436- /// Custom debug draw color.
437- uint32_t customColor ;
438-
439464 /// Indicates a closed chain formed by connecting the first and last points
440465 bool isLoop ;
441466
442- /// Generate events when a sensor overlaps this chain
443- bool enableSensorEvents ;
444-
445467 /// Used internally to detect a valid definition. DO NOT SET.
446468 int internalValue ;
447469} b2ChainDef ;
0 commit comments