LittleJS Box2D Physics Plugin
- Box2dObject extends EngineObject with Box2D physics
- Call box2dInit() before engineInit() to enable
- You will also need to include box2d.wasm.js
- Uses a super fast web assembly port of Box2D
- More info: https://github.com/kripken/box2d.js
- Functions to create polygon, circle, and edge shapes
- Contact begin and end callbacks
- Wraps b2Vec2 type to/from Vector2
- Raycasting and querying
- Every type of joint
- Debug physics drawing
- Source
Members
(static) box2d :Box2dPlugin
Global Box2d Plugin object
Type:
- Source
(static) box2dDebug :boolean
Enable Box2D debug drawing
Type:
- boolean
- Source
Methods
(async, static) box2dInit() → {Promise.<Box2dPlugin>}
Box2d Init - Call with await to init box2d
- Source
Returns:
- Type:
- Promise.<Box2dPlugin>
Example
await box2dInit();
(static) box2dSetDebug(enable)
Enable Box2D debug drawing
Parameters:
Name | Type | Description |
---|---|---|
enable | boolean |
- Source