Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable #366

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
9 changes: 6 additions & 3 deletions src/shapes/Shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ module.exports = Shape;

var vec2 = require('../math/vec2');

let PLAYER = Math.pow(2,0);
let EVERYTHING_EXCEPT_PLAYER = Math.pow(2,1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These must be vars to make grunt work correctly


/**
* Base class for shapes.
* @class Shape
Expand Down Expand Up @@ -98,7 +101,7 @@ function Shape(options){
* // The shapes will collide
* }
*/
this.collisionGroup = options.collisionGroup !== undefined ? options.collisionGroup : 1;
this.collisionGroup = options.collisionGroup !== undefined ? options.collisionGroup : EVERYTHING_EXCEPT_PLAYER;

/**
* Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. That means that this shape will move through other body shapes, but it will still trigger contact events, etc.
Expand All @@ -111,8 +114,8 @@ function Shape(options){
* @property collisionMask
* @type {Number}
*/
this.collisionMask = options.collisionMask !== undefined ? options.collisionMask : 1;

this.collisionMask = options.collisionMask !== undefined ? options.collisionMask : EVERYTHING_EXCEPT_PLAYER | PLAYER;
/**
* Material to use in collisions for this Shape. If this is set to null, the world will use default material properties instead.
* @property material
Expand Down