Class b2FixtureDef
A fixture definition (pybox2d's fixtureDef): the shape and material a b2Body creates a
fixture from. The shape is cloned into the fixture, so one definition can create many fixtures.
public class b2FixtureDef
- Inheritance
-
b2FixtureDef
- Inherited Members
- Extension Methods
Remarks
Reference: Box2D/Dynamics/b2Fixture.h.
Constructors
b2FixtureDef()
A fixture definition with Box2D's defaults (friction 0.2, no shape yet).
public b2FixtureDef()
b2FixtureDef(b2Shape?, double, double, double, bool, ushort, ushort, short, object?)
A fixture definition from pybox2d's keyword arguments (fixtureDef(shape=..., density=..., ...));
scalars round to float32 as SWIG converts them, and a refused one raises pybox2d's
Failed on kwargs for b2FixtureDef.density: … (its keyword named).
public b2FixtureDef(b2Shape? shape, double density = 0, double friction = 0.2, double restitution = 0, bool isSensor = false, ushort categoryBits = 1, ushort maskBits = 65535, short groupIndex = 0, object? userData = null)
Parameters
shapeb2ShapeThe shape, cloned by each fixture created from this definition.
densitydoubleThe density in kg/m².
frictiondoubleThe friction.
restitutiondoubleThe restitution.
isSensorboolWhether the fixture is a sensor.
categoryBitsushortThe collision category bits.
maskBitsushortThe collision mask bits.
groupIndexshortThe collision group.
userDataobjectThe fixture's user data.
Exceptions
- OverflowError
Thrown for a scalar beyond the float32 range.
Properties
CategoryBits
The collision category bits (pybox2d's categoryBits, a shortcut into Filter).
public ushort CategoryBits { get; set; }
Property Value
Density
The density in kg/m² (stored as float32).
public double Density { get; set; }
Property Value
Filter
The whole filter.
public b2Filter Filter { get; set; }
Property Value
Friction
The friction (stored as float32).
public double Friction { get; set; }
Property Value
GroupIndex
The collision group (pybox2d's groupIndex).
public short GroupIndex { get; set; }
Property Value
IsSensor
Whether the fixture is a sensor.
public bool IsSensor { get; set; }
Property Value
MaskBits
The collision mask bits (pybox2d's maskBits).
public ushort MaskBits { get; set; }
Property Value
Restitution
The restitution (stored as float32).
public double Restitution { get; set; }
Property Value
Shape
The shape (pybox2d's shape); fixtures clone it, so changing it later affects only new fixtures.
public b2Shape? Shape { get; set; }
Property Value
UserData
The fixture's user data.
public object? UserData { get; set; }