CannonSystem

CannonSystem

Cannon.js physics system. Depends on the global CANNON object, so load cannon.js using a script tag before using this system. See also CannonRigidbodyComponent.

Constructor

new CannonSystem(settingsopt)

Parameters:
Name Type Attributes Description
settings Object <optional>
Properties
Name Type Attributes Default Description
stepFrequency number <optional>
60
gravity Vector3 <optional>

The gravity to use in the scene. Default is (0, -10, 0)

broadphase string <optional>
'naive'

One of: 'naive' (NaiveBroadphase), 'sap' (SAPBroadphase)

Example
var cannonSystem = new CannonSystem({
    stepFrequency: 60,
    gravity: new Vector3(0, -10, 0)
});
sumerian.world.setSystem(cannonSystem);

Methods

setBroadphaseAlgorithm(algorithm)

Set the broadphase algorithm to use

Parameters:
Name Type Description
algorithm string

One of: 'naive' (NaiveBroadphase), 'sap' (SAPBroadphase)