File: src/material/Material.js
module.exports = Material;
/**
* Defines a physics material.
* @class Material
* @constructor
* @param {object} [options]
* @author schteppe
*/
function Material(options){
var name = '';
options = options || {};
// Backwards compatibility fix
if(typeof(options) === 'string'){
name = options;
options = {};
} else if(typeof(options) === 'object') {
name = '';
}
/**
* @property name
* @type {String}
*/
this.name = name;
/**
* material id.
* @property id
* @type {number}
*/
this.id = Material.idCounter++;
/**
* Friction for this material. If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from .defaultContactMaterial in the World will be used.
* @property {number} friction
*/
this.friction = typeof(options.friction) !== 'undefined' ? options.friction : -1;
/**
* Restitution for this material. If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from .defaultContactMaterial in the World will be used.
* @property {number} restitution
*/
this.restitution = typeof(options.restitution) !== 'undefined' ? options.restitution : -1;
}
Material.idCounter = 0;