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

World definition used to create a simulation world. More...

Public Member Functions

 WorldDef ()
 Creates a world definition with the default values.
 
 WorldDef (Vec2 gravity, float restitutionThreshold=0.0f, float hitEventThreshold=0.0f, float contactHertz=0.0f, float contactDampingRatio=0.0f, float maxContactPushSpeed=0.0f, float jointHertz=0.0f, float jointDampingRatio=0.0f, float maximumLinearSpeed=0.0f, bool enableSleep=true, bool enableContinuous=true, object? userData=null, FrictionCallback? frictionCallback=null, RestitutionCallback? restitutionCallback=null, EnqueueTaskCallback? enqueueTask=null, FinishTaskCallback? finishTask=null, object? userTaskContext=null)
 Construct a new world definition with the supplied values.
 

Properties

static WorldDef Default [get]
 Creates a world definition with the default values.
 
ref Vec2 Gravity [get]
 Gravity vector. Box2D has no up-vector defined.
 
ref float RestitutionThreshold [get]
 Restitution speed threshold, usually in m/s. Collisions above this speed have restitution applied (will bounce).
 
ref float HitEventThreshold [get]
 Threshold speed for hit events. Usually meters per second.
 
ref float ContactHertz [get]
 Contact stiffness. Cycles per second. Increasing this increases the speed of overlap recovery, but can introduce jitter.
 
ref float ContactDampingRatio [get]
 Contact bounciness. Non-dimensional. You can speed up overlap recovery by decreasing this with the trade-off that overlap resolution becomes more energetic.
 
ref float MaxContactPushSpeed [get]
 This parameter controls how fast overlap is resolved and usually has units of meters per second. This only puts a cap on the resolution speed. The resolution speed is increased by increasing the hertz and/or decreasing the damping ratio.
 
ref float JointHertz [get]
 Joint stiffness. Cycles per second.
 
ref float JointDampingRatio [get]
 Joint bounciness. Non-dimensional.
 
ref float MaximumLinearSpeed [get]
 Maximum linear speed. Usually meters per second.
 
ref FrictionCallback FrictionCallback [get]
 Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB).
 
ref RestitutionCallback RestitutionCallback [get]
 Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB).
 
bool EnableSleep [get, set]
 Can bodies go to sleep to improve performance.
 
bool EnableContinuous [get, set]
 Enable continuous collision.
 
int WorkerCount [get, set]
 Number of workers to use with the provided task system. Box2D performs best when using only performance cores and accessing a single L2 cache. Efficiency cores and hyper-threading provide little benefit and may even harm performance.
Note: Box2D does not create threads. This is the number of threads your applications has created that you are allocating to World.Step()
Warning: Do not modify the default value unless you are also providing a task system and providing task callbacks (enqueueTask and finishTask).
 
ref EnqueueTaskCallback EnqueueTask [get]
 Callback function to spawn tasks.
 
ref FinishTaskCallback FinishTask [get]
 Callback function to finish a task.
 
object? UserData [get, set]
 User data.
 
object? UserTaskContext [get, set]
 User context that is provided to enqueueTask and finishTask.
 

Detailed Description

World definition used to create a simulation world.

Constructor & Destructor Documentation

◆ WorldDef()

Box2D.WorldDef.WorldDef ( Vec2  gravity,
float  restitutionThreshold = 0::0f,
float  hitEventThreshold = 0::0f,
float  contactHertz = 0::0f,
float  contactDampingRatio = 0::0f,
float  maxContactPushSpeed = 0::0f,
float  jointHertz = 0::0f,
float  jointDampingRatio = 0::0f,
float  maximumLinearSpeed = 0::0f,
bool  enableSleep = true,
bool  enableContinuous = true,
object?  userData = null,
FrictionCallback frictionCallback = null,
RestitutionCallback restitutionCallback = null,
EnqueueTaskCallback enqueueTask = null,
FinishTaskCallback finishTask = null,
object?  userTaskContext = null 
)
inline

Construct a new world definition with the supplied values.

Parameters
gravityThe gravity vector
restitutionThresholdRestitution speed threshold
hitEventThresholdHit event threshold
contactHertzContact stiffness
contactDampingRatioContact bounciness
maxContactPushSpeedOverlap resolution speed
jointHertzJoint stiffness
jointDampingRatioJoint bounciness
maximumLinearSpeedMaximum linear speed
enableSleepEnable sleep
enableContinuousEnable continuous collision
userDataUser data
frictionCallbackFriction callback
restitutionCallbackRestitution callback
enqueueTaskEnqueue task callback
finishTaskFinish task callback
userTaskContextUser task context

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