photonstorm/phaser — pull request #674 by georgiee (2014-03-31 08:52:06+00:00)
Title: PhysicExporter update, updated flags in Cache & Loader

Hi added the ability to retrieve a single fixture from the cache. This becomes handy when you want to create some manual p2 bodies. I currently use it to maintain a list of circle sensors in Physics Editor. So I can maintain position, radius, mask bits, category bits and the sensor flag with PhysicsEditor.

Here an example to manually create a single sensor body:
```javascript
p2world = game.physics.p2
sensorFixture = game.cache.getPhysicsData('physics', 'mySensors', 'singleSensorFromTheList')
// [0,0] is the default position of a body
///You should set the position to (x - width/2) and (y - width/2) of the sprite this fixture was designed for in physics editor.
body = new p2.Body(position:[0,0])
//The retrieved fixture is a circle, so access it with the circle property
shape = new p2.Circle(p2world.pxm(fixture.circle.radius))

//these are set in PhysicsEditor via the bit field- so I do not have to manage them in Phaser
shape.collisionGroup = fixture.filter.categoryBits
shape.collisionMask = fixture.filter.maskBits
shape.sensor = shape.isSensor
//the offset inside the body. This is easy for a circle. For a polygon you have to calcualte the mass center. See phaser's p2 body how to do it in case you want to create a manual polygon.
offset = fixture.circle.position
offset[0] = p2world.pxmi(offset[0])
offset[1] = p2world.pxmi(offset[1])

body.addShape(shape, offset)
p2world.world.addBody(body)
debugBody = new Phaser.Physics.P2.BodyDebug(game, body)
```