Table of Contents

Class b2FixtureDef

Namespace
Gym.Box2D
Assembly
Gym.Environments.dll

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

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

shape b2Shape

The shape, cloned by each fixture created from this definition.

density double

The density in kg/m².

friction double

The friction.

restitution double

The restitution.

isSensor bool

Whether the fixture is a sensor.

categoryBits ushort

The collision category bits.

maskBits ushort

The collision mask bits.

groupIndex short

The collision group.

userData object

The 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

ushort

Density

The density in kg/m² (stored as float32).

public double Density { get; set; }

Property Value

double

Filter

The whole filter.

public b2Filter Filter { get; set; }

Property Value

b2Filter

Friction

The friction (stored as float32).

public double Friction { get; set; }

Property Value

double

GroupIndex

The collision group (pybox2d's groupIndex).

public short GroupIndex { get; set; }

Property Value

short

IsSensor

Whether the fixture is a sensor.

public bool IsSensor { get; set; }

Property Value

bool

MaskBits

The collision mask bits (pybox2d's maskBits).

public ushort MaskBits { get; set; }

Property Value

ushort

Restitution

The restitution (stored as float32).

public double Restitution { get; set; }

Property Value

double

Shape

The shape (pybox2d's shape); fixtures clone it, so changing it later affects only new fixtures.

public b2Shape? Shape { get; set; }

Property Value

b2Shape

UserData

The fixture's user data.

public object? UserData { get; set; }

Property Value

object