HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
Box2D.ShapeDef Class Referencesealed

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...

Public Member Functions

 ShapeDef (SurfaceMaterial material, float density, Filter filter, bool isSensor=false, bool enableSensorEvents=false, bool enableContactEvents=false, bool enableHitEvents=false, bool enablePreSolveEvents=false, bool invokeContactCreation=false, bool updateBodyMass=true, object? userData=null)
 Construct a shape definition with the supplied values.
 
 ShapeDef ()
 Construct a shape definition with the default values.
 

Properties

object? UserData [get, set]
 Use this to store application specific shape data.
 
ref SurfaceMaterial Material [get]
 The surface material for this shape.
 
ref float Density [get]
 The density, usually in kg/m².
 
ref Filter Filter [get]
 Collision filtering data.
 
bool IsSensor [get, set]
 A sensor shape generates overlap events but never generates a collision response. Sensors do not have continuous collision. Instead, use a ray or shape cast for those scenarios. Note: Sensor events are disabled by default.
 
bool EnableSensorEvents [get, set]
 Enable sensor events for this shape. This applies to sensors and non-sensors. False by default, even for sensors.
 
bool EnableContactEvents [get, set]
 Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.
 
bool EnableHitEvents [get, set]
 Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.
 
bool EnablePreSolveEvents [get, set]
 Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to threading. Ignored for sensors.
 
bool InvokeContactCreation [get, set]
 Normally shapes on static bodies don't invoke contact creation when they are added to the world. This overrides that behavior and causes contact creation. This significantly slows down static body creation which can be important when there are many static shapes. This is implicitly always true for sensors, dynamic bodies, and kinematic bodies.
 
bool UpdateBodyMass [get, set]
 Should the body update the mass properties when this shape is created. Default is true.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ShapeDef()

Box2D.ShapeDef.ShapeDef ( SurfaceMaterial  material,
float  density,
Filter  filter,
bool  isSensor = false,
bool  enableSensorEvents = false,
bool  enableContactEvents = false,
bool  enableHitEvents = false,
bool  enablePreSolveEvents = false,
bool  invokeContactCreation = false,
bool  updateBodyMass = true,
object?  userData = null 
)
inline

Construct a shape definition with the supplied values.

Parameters
materialThe surface material for this shape.
densityThe density, usually in kg/m².
filterCollision filtering data.
isSensorA sensor shape generates overlap events but never generates a collision response. Sensors do not have continuous collision. Instead, use a ray or shape cast for those scenarios. Note: Sensor events are disabled by default.
enableSensorEventsEnable sensor events for this shape. This applies to sensors and non-sensors. False by default, even for sensors.
enableContactEventsEnable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.
enableHitEventsEnable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default.
enablePreSolveEventsEnable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to threading. Ignored for sensors.
invokeContactCreationNormally shapes on static bodies don't invoke contact creation when they are added to the world. This overrides that behavior and causes contact creation. This significantly slows down static body creation which can be important when there are many static shapes. This is implicitly always true for sensors, dynamic bodies, and kinematic bodies.
updateBodyMassShould the body update the mass properties when this shape is created. Default is true.
userDataUser data

The documentation for this class was generated from the following file: