World2D
A 2D physics world container.
Properties
| Property | Type | Default |
|---|---|---|
Gravity | Vector2 | Vector2.new(0, 981) |
TimeScale | number | 1 |
Paused | boolean | false |
ResetOnSpawn | boolean | true |
Position | UDim2 | UDim2.new(0, 0, 0, 0) |
Size | UDim2 | UDim2.new(0, 400, 0, 400) |
RenderOffset | Vector2 | Vector2.new(0, 0) |
OverrideScreenSize | boolean | false |
FixedDeltaTime | any | 1 / 60 |
ElapsedTime | number | 0 |
Accumulator | number | 0 |
contactHertz | number | 60 |
contactDampingRatio | number | 1 |
maximumLinearSpeed | number | 4000 |
maximumAngularSpeed | number | 4000 |
restitutionThreshold | number | 1.0 |
hitEventThreshold | number | 0.0 |
maxContactPushSpeed | number | 3.0 |
enableSleep | boolean | true |
enableContinuous | boolean | true |
workerCount | number | 0 |
Bodies | table | {} |
Constraints | table | {} |
CollisionLayers | table | {} |
UseBounds | boolean | false |
MinBounds | Vector2 | Vector2.new(-math.huge, -math.huge) |
MaxBounds | Vector2 | Vector2.new(math.huge, math.huge) |
VelocityIterations | number | 8 |
PositionIterations | number | 3 |
AllowSleep | boolean | true |
DebugDraw | boolean | false |
DebugColor | any | nil |
Functions
update
Arguments
This function takes no arguments.
Returns
This function returns nothing.
AddBody
Arguments
self, bodyReturns
This function returns nothing.
RemoveBody
Arguments
self, bodyReturns
This function returns nothing.
AddConstraint
Arguments
self, constraintReturns
This function returns nothing.
RemoveConstraint
Arguments
self, constraintReturns
This function returns nothing.
Clear
Arguments
selfReturns
This function returns nothing.
Step
Arguments
self, dtReturns
This function returns nothing.
API
instance:update()
instance:AddBody(self, body)
instance:RemoveBody(self, body)
instance:AddConstraint(self, constraint)
instance:RemoveConstraint(self, constraint)
instance:Clear(self)
instance:Step(self, dt)