Constructor
new Box2dPlugin(instance)
Create the global UI system object
| Name | Type | Description |
|---|---|---|
instance | Object |
- Source
Members
bodyTypeDynamic
Properties| Type | Description |
|---|---|
| number | Dynamic, positive mass, non-zero velocity determined by forces, moved by solver |
- Source
bodyTypeKinematic
Properties| Type | Description |
|---|---|
| number | Kinematic, zero mass, non-zero velocity set by user, moved by solver |
- Source
bodyTypeStatic
Properties| Type | Description |
|---|---|
| number | Static, zero mass, zero velocity, may be manually moved |
- Source
instance
Properties| Type | Description |
|---|---|
| Object | The Box2d instance |
- Source
objects
Properties| Type | Description |
|---|---|
| Array.<Box2dObject> | List of all Box2d objects |
- Source
positionIterations
Properties| Type | Description |
|---|---|
| number | Position iterations per update |
- Source
velocityIterations
Properties| Type | Description |
|---|---|
| number | Velocity iterations per update |
- Source
world
Properties| Type | Description |
|---|---|
| Object | The Box2d world |
- Source
Methods
boxCast(pos, size)
box aabb cast and return the first object
| Name | Type | Description |
|---|---|---|
pos | Vector2 | |
size | Vector2 |
- Source
boxCastAll(pos, size)
box aabb cast and return all the objects
| Name | Type | Description |
|---|---|---|
pos | Vector2 | |
size | Vector2 |
- Source
castObjectType(o)
casts a box2d object to its correct type
| Name | Type | Description |
|---|---|---|
o | Object |
- Source
circleCast(pos, diameter)
circle cast and return the first object
| Name | Type | Description |
|---|---|---|
pos | Vector2 | |
diameter | number |
- Source
circleCastAll(pos, diameter)
circle cast and return all the objects
| Name | Type | Description |
|---|---|---|
pos | Vector2 | |
diameter | number |
- Source
drawFixture(fixture, pos, angle, coloropt, lineColoropt, lineWidthopt, useWebGLopt, contextopt)
draws a fixture
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fixture | Object | |||
pos | Vector2 | |||
angle | number | |||
color | Color | <optional> | ||
lineColor | Color | <optional> | ||
lineWidth | number | <optional> | 0.1 | |
useWebGL | boolean | <optional> | glEnable | |
context | CanvasRenderingContext2D | <optional> |
- Source
isNull(o)
checks if a box2d object is null
| Name | Type | Description |
|---|---|---|
o | Object |
- Source
pointCast(pos, dynamicOnly)
point cast and return the first object
| Name | Type | Default | Description |
|---|---|---|---|
pos | Vector2 | ||
dynamicOnly | boolean | true |
- Source
raycast(start, end)
raycast and return the first result
| Name | Type | Description |
|---|---|---|
start | Vector2 | |
end | Vector2 |
- Source
raycastAll(start, end)
raycast and return a list of all the results
| Name | Type | Description |
|---|---|---|
start | Vector2 | |
end | Vector2 |
- Source
step(framesopt)
Step the physics world simulation
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
frames | number | <optional> | 1 |
- Source
vec2From(v)
converts a box2d vec2 to a Vector2
| Name | Type | Description |
|---|---|---|
v | Object |
- Source
vec2FromPointer(vp)
converts a box2d vec2 pointer to a Vector2
| Name | Type | Description |
|---|---|---|
vp | Object |
- Source
vec2dTo(v)
converts a Vector2 to a box2 vec2
| Name | Type | Description |
|---|---|---|
v | Vector2 |
- Source