PhysicsSystem
MRSystem
PhysicsSystem ⇐ The physics system functions differently from other systems, Rather than attaching components, physical properties such as shape, body, mass, etc are definied as attributes. if shape and body are not defined, they default to the geometry of the entity, if there is no geometry, there is no physics defined on the entity.
Alternatively, you can also expressly attach a comp-physics attribute for more detailed control.
Kind: global class
Extends: MRSystem
- PhysicsSystem ⇐
MRSystem
- .PhysicsSystem
- .eventUpdate()
- .entityEventUpdate(e)
- .update(deltaTime, frame)
- .onNewEntity(entity)
- .entityRemoved(entity)
- .initPhysicsBody(entity)
- .initUIEntityBody(entity)
- .initSimpleBody(entity)
- .initDetailedBody(entity)
- .updateBody(entity)
- .updateUIBody(entity)
- .updateSimpleBody(entity)
- .updateDebugRenderer()
physicsSystem.PhysicsSystem
Kind: instance class of PhysicsSystem
new exports.PhysicsSystem()
PhysicsSystem’s default constructor - sets up useful world and debug information alongside an initial Rapier
event queue.
physicsSystem.eventUpdate()
The per global scene event update call. Based on the captured physics events for the frame, handles all items appropriately.
Kind: instance method of PhysicsSystem
physicsSystem.entityEventUpdate(e)
a function called when a specific entity has an event update
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
e | Event |
the event generated by the entity |
physicsSystem.update(deltaTime, frame)
The per-frame system update call. Based on the captured physics events for the frame, handles all items appropriately.
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
deltaTime | number |
given timestep to be used for any feature changes |
frame | object |
given frame information to be used for any feature changes |
physicsSystem.onNewEntity(entity)
When a new entity is created, adds it to the physics registry and initializes the physics aspects of the entity.
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being set up |
physicsSystem.entityRemoved(entity)
when an entity is removed, remove and destroy it’s physics body
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the removed entity |
physicsSystem.initPhysicsBody(entity)
Initializes the rigid body used by the physics part of the entity
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.initUIEntityBody(entity)
Initializes the rigid body used by the physics for non-nr-model div entities
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.initSimpleBody(entity)
Initializes a simple bounding box collider based on the visual bounds of the entity
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.initDetailedBody(entity)
Initializes a Rigid Body detailed convexMesh collider for the entity NOTE: not currently in use until we can sync it with animations
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.updateBody(entity)
Updates the rigid body used by the physics part of the entity
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.updateUIBody(entity)
Updates the rigid body used by the physics part of the div entity
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.updateSimpleBody(entity)
Updates the rigid body used by the physics part of the model entity
Kind: instance method of PhysicsSystem
Param | Type | Description |
---|---|---|
entity | MREntity |
the entity being updated |
physicsSystem.updateDebugRenderer()
Updates the debug renderer to either be on or off based on the ‘this.debug’ variable. Handles the drawing of the visual lines.
Kind: instance method of PhysicsSystem