src/system.js
function () {
    var data = this.data;

    // If true, show wireframes around physics bodies.
    this.debug = data.debug;

    this.callbacks = {beforeStep: [], step: [], afterStep: []};

    this.listeners = {};

    this.driver = null;
    switch (data.driver) {
      case 'local':
        this.driver = new LocalDriver();
        break;

      case 'network':
        this.driver = new NetworkDriver(data.networkUrl);
        break;

      case 'worker':
        this.driver = new WorkerDriver({
          fps: data.workerFps,
          engine: data.workerEngine,
          interpolate: data.workerInterpolate,
          interpolationBufferSize: data.workerInterpBufferSize,
          debug: data.workerDebug
        });
        break;

      default:
        throw new Error('[physics] Driver not recognized: "%s".', data.driver);
    }

    this.driver.init({
      quatNormalizeSkip: 0,
      quatNormalizeFast: false,
      solverIterations: data.iterations,
      gravity: data.gravity
    });

    this.driver.addMaterial({name: 'defaultMaterial'});
    this.driver.addMaterial({name: 'staticMaterial'});
    this.driver.addContactMaterial('defaultMaterial', 'defaultMaterial', {
      friction: data.friction,
      restitution: data.restitution,
      contactEquationStiffness: data.contactEquationStiffness,
      contactEquationRelaxation: data.contactEquationRelaxation,
      frictionEquationStiffness: data.frictionEquationStiffness,
      frictionEquationRegularization: data.frictionEquationRegularization
    });
    this.driver.addContactMaterial('staticMaterial', 'defaultMaterial', {
      friction: 1.0,
      restitution: 0.0,
      contactEquationStiffness: data.contactEquationStiffness,
      contactEquationRelaxation: data.contactEquationRelaxation,
      frictionEquationStiffness: data.frictionEquationStiffness,
      frictionEquationRegularization: data.frictionEquationRegularization
    });
  }
function () {
    var data = this.data;

    // If true, show wireframes around physics bodies.
    this.debug = data.debug;

    this.callbacks = {beforeStep: [], step: [], afterStep: []};

    this.listeners = {};

    this.driver = null;
    switch (data.driver) {
      case 'local':
        this.driver = new LocalDriver();
        break;

      case 'network':
        this.driver = new NetworkDriver(data.networkUrl);
        break;

      case 'worker':
        this.driver = new WorkerDriver({
          fps: data.workerFps,
          engine: data.workerEngine,
          interpolate: data.workerInterpolate,
          interpolationBufferSize: data.workerInterpBufferSize,
          debug: data.workerDebug
        });
        break;

      default:
        throw new Error('[physics] Driver not recognized: "%s".', data.driver);
    }

    this.driver.init({
      quatNormalizeSkip: 0,
      quatNormalizeFast: false,
      solverIterations: data.iterations,
      gravity: data.gravity
    });

    this.driver.addMaterial({name: 'defaultMaterial'});
    this.driver.addMaterial({name: 'staticMaterial'});
    this.driver.addContactMaterial('defaultMaterial', 'defaultMaterial', {
      friction: data.friction,
      restitution: data.restitution,
      contactEquationStiffness: data.contactEquationStiffness,
      contactEquationRelaxation: data.contactEquationRelaxation,
      frictionEquationStiffness: data.frictionEquationStiffness,
      frictionEquationRegularization: data.frictionEquationRegularization
    });
    this.driver.addContactMaterial('staticMaterial', 'defaultMaterial', {
      friction: 1.0,
      restitution: 0.0,
      contactEquationStiffness: data.contactEquationStiffness,
      contactEquationRelaxation: data.contactEquationRelaxation,
      frictionEquationStiffness: data.frictionEquationStiffness,
      frictionEquationRegularization: data.frictionEquationRegularization
    });
  }
function ( ) { var data = this . data ; // If true, show wireframes around physics bodies. this . debug = data . debug ; this . callbacks = { beforeStep : [ ] , step : [ ] , afterStep : [ ] } ; this . listeners = { } ; this . driver = null ; switch ( data . driver ) { case 'local' : this . driver = new LocalDriver ( ) ; break ; case 'network' : this . driver = new NetworkDriver ( data . networkUrl ) ; break ; case 'worker' : this . driver = new WorkerDriver ( { fps : data . workerFps , engine : data . workerEngine , interpolate : data . workerInterpolate , interpolationBufferSize : data . workerInterpBufferSize , debug : data . workerDebug } ) ; break ; default : throw new Error ( '[physics] Driver not recognized: "%s".' , data . driver ) ; } this . driver . init ( { quatNormalizeSkip : 0 , quatNormalizeFast : false , solverIterations : data . iterations , gravity : data . gravity } ) ; this . driver . addMaterial ( { name : 'defaultMaterial' } ) ; this . driver . addMaterial ( { name : 'staticMaterial' } ) ; this . driver . addContactMaterial ( 'defaultMaterial' , 'defaultMaterial' , { friction : data . friction , restitution : data . restitution , contactEquationStiffness : data . contactEquationStiffness , contactEquationRelaxation : data . contactEquationRelaxation , frictionEquationStiffness : data . frictionEquationStiffness , frictionEquationRegularization : data . frictionEquationRegularization } ) ; this . driver . addContactMaterial ( 'staticMaterial' , 'defaultMaterial' , { friction : 1.0 , restitution : 0.0 , contactEquationStiffness : data . contactEquationStiffness , contactEquationRelaxation : data . contactEquationRelaxation , frictionEquationStiffness : data . frictionEquationStiffness , frictionEquationRegularization : data . frictionEquationRegularization } ) ; }
Initializes the physics system.
Initializes the physics system .