phaser/build/custom/p2.min.js

6 lines
139 KiB
JavaScript
Raw Normal View History

2014-04-15 14:39:23 +00:00
/* p2.js custom build for Phaser v2.0.4 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define("p2",function(){return this.p2=a()}()):"undefined"!=typeof window?window.p2=a():"undefined"!=typeof global?self.p2=a():"undefined"!=typeof self&&(self.p2=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){if(!d)var d=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;var f={};f.setMatrixArrayType=function(a){e=a},"undefined"!=typeof c&&(c.glMatrix=f);var g={};g.create=function(){var a=new e(2);return a[0]=0,a[1]=0,a},g.clone=function(a){var b=new e(2);return b[0]=a[0],b[1]=a[1],b},g.fromValues=function(a,b){var c=new e(2);return c[0]=a,c[1]=b,c},g.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a},g.set=function(a,b,c){return a[0]=b,a[1]=c,a},g.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a},g.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a},g.sub=g.subtract,g.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a},g.mul=g.multiply,g.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a},g.div=g.divide,g.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a},g.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a},g.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a},g.distance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return Math.sqrt(c*c+d*d)},g.dist=g.distance,g.squaredDistance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d},g.sqrDist=g.squaredDistance,g.length=function(a){var b=a[0],c=a[1];return Math.sqrt(b*b+c*c)},g.len=g.length,g.squaredLength=function(a){var b=a[0],c=a[1];return b*b+c*c},g.sqrLen=g.squaredLength,g.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a},g.normalize=function(a,b){var c=b[0],d=b[1],e=c*c+d*d;return e>0&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e),a},g.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]},g.cross=function(a,b,c){var d=b[0]*c[1]-b[1]*c[0];return a[0]=a[1]=0,a[2]=d,a},g.lerp=function(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a},g.transformMat2=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[2]*e,a[1]=c[1]*d+c[3]*e,a},g.transformMat2d=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[2]*e+c[4],a[1]=c[1]*d+c[3]*e+c[5],a},g.transformMat3=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[3]*e+c[6],a[1]=c[1]*d+c[4]*e+c[7],a},g.transformMat4=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[4]*e+c[12],a[1]=c[1]*d+c[5]*e+c[13],a},g.forEach=function(){var a=g.create();return function(b,c,d,e,f,g){var h,i;for(c||(c=2),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],f(a,a,g),b[h]=a[0],b[h+1]=a[1];return b}}(),g.str=function(a){return"vec2("+a[0]+", "+a[1]+")"},"undefined"!=typeof c&&(c.vec2=g)},{}],2:[function(a,b){function c(){}var d=a("./Scalar");b.exports=c,c.lineInt=function(a,b,c){c=c||0;var e,f,g,h,i,j,k,l=[0,0];return e=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=e*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=e*i-h*f,d.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(e*j-h*g)/k),l},c.segmentsIntersect=function(a,b,c,d){var e=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(g*f-h*e==0)return!1;var i=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);return i>=0&&1>=i&&j>=0&&1>=j}},{"./Scalar":5}],3:[function(a,b){function c(){}b.exports=c,c.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},c.left=function(a,b,d){return c.area(a,b,d)>0},c.leftOn=function(a,b,d){return c.area(a,b,d)>=0},c.right=function(a,b,d){return c.area(a,b,d)<0},c.rightOn=function(a,b,d){return c.area(a,b,d)<=0};var d=[],e=[];c.collinear=function(a,b,f,g
}return k};var eb=g.create(),fb=g.create(),gb=g.create(),hb=g.create(),ib=g.create(),jb=g.create(),kb=g.create();c.prototype[o.CIRCLE|o.HEIGHTFIELD]=c.prototype.circleHeightfield=function(a,b,c,d,e,f,j,k,l,m){var n=f.data,m=m||b.radius,o=f.elementWidth,p=fb,q=eb,r=ib,s=kb,t=jb,u=gb,v=hb,w=Math.floor((c[0]-m-j[0])/o),x=Math.ceil((c[0]+m-j[0])/o);0>w&&(w=0),x>=n.length&&(x=n.length-1);for(var y=n[w],z=n[x],A=w;x>A;A++)n[A]<z&&(z=n[A]),n[A]>y&&(y=n[A]);if(c[1]-m>y)return l?!1:0;c[1]+m<z;for(var B=!1,C=!1,A=w;x>A;A++){g.set(u,A*o,n[A]),g.set(v,(A+1)*o,n[A+1]),g.add(u,u,j),g.add(v,v,j),g.sub(t,v,u),g.rotate(t,t,Math.PI/2),g.normalize(t,t),g.scale(q,t,-m),g.add(q,q,c),g.sub(p,q,u);var D=g.dot(p,t);if(q[0]>=u[0]&&q[0]<v[0]&&0>=D&&(C===!1||Math.abs(D)<C)&&(g.scale(p,t,-D),g.add(r,q,p),g.copy(s,t),B=!0,C=Math.abs(D),l))return!0}if(B){var E=this.createContactEquation(e,a,f,b);return g.copy(E.normalA,s),g.scale(E.contactPointB,E.normalA,-m),i(E.contactPointB,E.contactPointB,c),h(E.contactPointB,E.contactPointB,a.position),g.copy(E.contactPointA,r),g.sub(E.contactPointA,E.contactPointA,e.position),this.contactEquations.push(E),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(E)),1}if(m>0)for(var A=w;x>=A;A++)if(g.set(u,A*o,n[A]),g.add(u,u,j),g.sub(p,c,u),g.squaredLength(p)<m*m){if(l)return!0;var E=this.createContactEquation(e,a,f,b);return g.copy(E.normalA,p),g.normalize(E.normalA,E.normalA),g.scale(E.contactPointB,E.normalA,-m),i(E.contactPointB,E.contactPointB,c),h(E.contactPointB,E.contactPointB,a.position),h(E.contactPointA,u,j),i(E.contactPointA,E.contactPointA,j),h(E.contactPointA,E.contactPointA,e.position),this.contactEquations.push(E),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(E)),1}return 0}},{"../equations/ContactEquation":21,"../equations/FrictionEquation":23,"../math/vec2":30,"../objects/Body":31,"../shapes/Circle":35,"../shapes/Rectangle":41,"../shapes/Shape":42,"../utils/Utils":45}],13:[function(a,b){function c(){e.call(this,e.SAP),this.axisListX=[],this.axisListY=[],this.world=null;var a=this.axisListX,b=this.axisListY;this._addBodyHandler=function(c){a.push(c.body),b.push(c.body)},this._removeBodyHandler=function(c){var d=a.indexOf(c.body);-1!==d&&a.splice(d,1),d=b.indexOf(c.body),-1!==d&&b.splice(d,1)}}{var d=(a("../shapes/Circle"),a("../shapes/Plane"),a("../shapes/Shape"),a("../shapes/Particle"),a("../utils/Utils")),e=a("../collision/Broadphase");a("../math/vec2")}b.exports=c,c.prototype=new e,c.prototype.setWorld=function(a){this.axisListX.length=this.axisListY.length=0,d.appendArray(this.axisListX,a.bodies),d.appendArray(this.axisListY,a.bodies),a.off("addBody",this._addBodyHandler).off("removeBody",this._removeBodyHandler),a.on("addBody",this._addBodyHandler).on("removeBody",this._removeBodyHandler),this.world=a},c.sortAxisListX=function(a){for(var b=1,c=a.length;c>b;b++){for(var d=a[b],e=b-1;e>=0&&!(a[e].aabb.lowerBound[0]<=d.aabb.lowerBound[0]);e--)a[e+1]=a[e];a[e+1]=d}return a},c.sortAxisListY=function(a){for(var b=1,c=a.length;c>b;b++){for(var d=a[b],e=b-1;e>=0&&!(a[e].aabb.lowerBound[1]<=d.aabb.lowerBound[1]);e--)a[e+1]=a[e];a[e+1]=d}return a};var f={keys:[]};c.prototype.getCollisionPairs=function(){{var a=this.axisListX,b=this.axisListY,d=this.result;this.axisIndex}d.length=0;for(var g=0;g!==a.length;g++){var h=a[g];h.aabbNeedsUpdate&&h.updateAABB()}c.sortAxisListX(a),c.sortAxisListY(b);for(var g=0,i=a.length;g!==i;g++)for(var j=a[g],k=g+1;i>k;k++){var l=a[k];if(!c.checkBounds(j,l,0))break;if(e.canCollide(j,l)){var m=j.id<l.id?j.id+" "+l.id:l.id+" "+j.id;f[m]=!0,f.keys.push(m)}}for(var g=0,i=b.length;g!==i;g++)for(var j=b[g],k=g+1;i>k;k++){var l=b[k];if(!c.checkBounds(j,l,1))break;if(e.canCollide(j,l)){var m=j.id<l.id?j.id+" "+l.id:l.id+" "+j.id;f[m]&&this.boundingVolumeCheck(j,l)&&d.push(j,l)}}for(var n=f.keys,g=0,i=n.length;g!==i;g++)delete f[n[g]];return n.length=0,d},c.checkBounds=function(a,b,c){return b.aabb.lowerBound[c]<=a.aabb.upperBound[c]}},{"../collision/Broadphase":9,"../math/vec2":30,"../shapes/Circle":35,"../shapes/Particl
},{"../package.json":7,"./collision/AABB":8,"./collision/Broadphase":9,"./collision/GridBroadphase":10,"./collision/NaiveBroadphase":11,"./collision/Narrowphase":12,"./collision/SAPBroadphase":13,"./constraints/Constraint":14,"./constraints/DistanceConstraint":15,"./constraints/GearConstraint":16,"./constraints/LockConstraint":17,"./constraints/PrismaticConstraint":18,"./constraints/RevoluteConstraint":19,"./equations/AngleLockEquation":20,"./equations/ContactEquation":21,"./equations/Equation":22,"./equations/FrictionEquation":23,"./equations/RotationalVelocityEquation":25,"./events/EventEmitter":26,"./material/ContactMaterial":27,"./material/Material":28,"./math/vec2":30,"./objects/Body":31,"./objects/Spring":32,"./shapes/Capsule":34,"./shapes/Circle":35,"./shapes/Convex":36,"./shapes/Heightfield":37,"./shapes/Line":38,"./shapes/Particle":39,"./shapes/Plane":40,"./shapes/Rectangle":41,"./shapes/Shape":42,"./solver/GSSolver":43,"./solver/Solver":44,"./utils/Utils":45,"./world/World":49}],34:[function(a,b){function c(a,b){this.length=a||1,this.radius=b||1,d.call(this,d.CAPSULE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius,c=this.length+b,d=2*b;return a*(d*d+c*c)/12},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius+this.length/2},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius+2*this.radius*this.length};var f=e.create();c.prototype.computeAABB=function(a,b,c){var d=this.radius;e.set(f,this.length,0),e.rotate(f,f,c),e.set(a.upperBound,Math.max(f[0]+d,-f[0]+d),Math.max(f[1]+d,-f[1]+d)),e.set(a.lowerBound,Math.min(f[0]-d,-f[0]-d),Math.min(f[1]-d,-f[1]-d)),e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b)}},{"../math/vec2":30,"./Shape":42}],35:[function(a,b){function c(a){this.radius=a||1,d.call(this,d.CIRCLE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius;return a*b*b/2},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},c.prototype.computeAABB=function(a,b){var c=this.radius;e.set(a.upperBound,c,c),e.set(a.lowerBound,-c,-c),b&&(e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b))}},{"../math/vec2":30,"./Shape":42}],36:[function(a,b){function c(a){this.vertices=[];for(var b=0;b<a.length;b++){var c=e.create();e.copy(c,a[b]),this.vertices.push(c)}if(this.centerOfMass=e.fromValues(0,0),this.triangles=[],this.vertices.length&&(this.updateTriangles(),this.updateCenterOfMass()),this.boundingRadius=0,d.call(this,d.CONVEX),this.updateBoundingRadius(),this.updateArea(),this.area<0)throw new Error("Convex vertices must be given in conter-clockwise winding.")}{var d=a("./Shape"),e=a("../math/vec2"),f=a("../math/polyk");a("poly-decomp")}b.exports=c,c.prototype=new d,c.prototype.updateTriangles=function(){this.triangles.length=0;for(var a=[],b=0;b<this.vertices.length;b++){var c=this.vertices[b];a.push(c[0],c[1])}for(var d=f.Triangulate(a),b=0;b<d.length;b+=3){var e=d[b],g=d[b+1],h=d[b+2];this.triangles.push([e,g,h])}};{var g=e.create(),h=e.create(),i=e.create(),j=e.create(),k=e.create();e.create(),e.create(),e.create(),e.create()}c.prototype.updateCenterOfMass=function(){var a=this.triangles,b=this.vertices,d=this.centerOfMass,f=g,l=i,m=j,n=k,o=h;e.set(d,0,0);for(var p=0,q=0;q!==a.length;q++){var r=a[q],l=b[r[0]],m=b[r[1]],n=b[r[2]];e.centroid(f,l,m,n);var s=c.triangleArea(l,m,n);p+=s,e.scale(o,f,s),e.add(d,d,o)}e.scale(d,d,1/p)},c.prototype.computeMomentOfInertia=function(a){for(var b=0,c=0,d=this.vertices.length,f=d-1,g=0;d>g;f=g,g++){var h=this.vertices[f],i=this.vertices[g],j=Math.abs(e.crossLength(h,i)),k=e.dot(i,i)+e.dot(i,h)+e.dot(h,h);b+=j*k,c+=j}return a/6*(b/c)},c.prototype.updateBoundingRadius=function(){for(var a=this.vertices,b=0,c=0;c!==a.length;c++){var d=e.squaredLength(a[c]);d>b&&(b=d)}this.boundingRadius=Math.sqrt(b)},c.triangleArea=function(a,b,c){retu
2014-04-15 14:39:23 +00:00
if(!H)return this.error="instance.springs["+r+"] references instance.body["+d.bodyA+"], which does not exist.",!1;if(!I)return this.error="instance.springs["+r+"] references instance.body["+d.bodyB+"], which does not exist.",!1;var e=new u(H,I,{stiffness:d.stiffness,damping:d.damping,restLength:d.restLength,localAnchorA:d.localAnchorA,localAnchorB:d.localAnchorB});c.addSpring(e)}for(var r=0;r<a.contactMaterials.length;r++){var t=a.contactMaterials[r],J=h[t.materialA+""],K=h[t.materialB+""];if(!J)return this.error="Reference to material id "+t.materialA+": material not found",!1;if(!K)return this.error="Reference to material id "+t.materialB+": material not found",!1;var L=new w(J,K,{friction:t.friction,restitution:t.restitution,stiffness:t.stiffness,relaxation:t.relaxation,frictionStiffness:t.frictionStiffness,frictionRelaxation:t.frictionRelaxation});L.id=t.id,c.addContactMaterial(L)}var t=a.defaultContactMaterial,J=c.defaultMaterial,K=c.defaultMaterial,L=new w(J,K,{friction:t.friction,restitution:t.restitution,stiffness:t.stiffness,relaxation:t.relaxation,frictionStiffness:t.frictionStiffness,frictionRelaxation:t.frictionRelaxation});L.id=t.id,c.defaultContactMaterial=L;for(var r=0;r<a.distanceConstraints.length;r++){var M=a.distanceConstraints[r];c.addConstraint(new x(f[M.bodyA],f[M.bodyB],M.distance,{maxForce:M.maxForce,collideConnected:M.collideConnected}))}for(var r=0;r<a.revoluteConstraints.length;r++){var M=a.revoluteConstraints[r],N=new A(f[M.bodyA],M.pivotA,f[M.bodyB],M.pivotB,{maxForce:M.maxForce,collideConnected:M.collideConnected});M.motorEnabled&&N.enableMotor(),N.setMotorSpeed(M.motorSpeed),N.lowerLimit=M.lowerLimit,N.upperLimit=M.upperLimit,N.lowerLimitEnabled=M.lowerLimitEnabled,N.upperLimitEnabled=M.upperLimitEnabled,c.addConstraint(N)}for(var r=0;r<a.prismaticConstraints.length;r++){var M=a.prismaticConstraints[r],O=new B(f[M.bodyA],f[M.bodyB],{maxForce:M.maxForce,localAxisA:M.localAxisA,localAnchorA:M.localAnchorA,localAnchorB:M.localAnchorB,collideConnected:M.collideConnected});O.motorSpeed=M.motorSpeed,c.addConstraint(O)}for(var r=0;r<a.lockConstraints.length;r++){var M=a.lockConstraints[r];c.addConstraint(new z(f[M.bodyA],f[M.bodyB],{maxForce:M.maxForce,localOffsetB:M.localOffsetB,localAngleB:M.localAngleB,collideConnected:M.collideConnected}))}for(var r=0;r<a.gearConstraints.length;r++){var M=a.gearConstraints[r];c.addConstraint(new C(f[M.bodyA],f[M.bodyB],{maxForce:M.maxForce,angle:M.angle,ratio:M.ratio,collideConnected:M.collideConnected}))}return!0},c.prototype.clear=function(){this.time=0,this.fixedStepTime=0,this.solver&&this.solver.equations.length&&this.solver.removeAllEquations();for(var a=this.constraints,b=a.length-1;b>=0;b--)this.removeConstraint(a[b]);for(var d=this.bodies,b=d.length-1;b>=0;b--)this.removeBody(d[b]);for(var e=this.springs,b=e.length-1;b>=0;b--)this.removeSpring(e[b]);for(var f=this.contactMaterials,b=f.length-1;b>=0;b--)this.removeContactMaterial(f[b]);c.apply(this)},c.prototype.clone=function(){var a=new c;return a.fromJSON(this.toJSON()),a};var Q=j.create(),R=j.fromValues(0,0),S=j.fromValues(0,0);c.prototype.hitTest=function(a,b,c){c=c||0;var d=new s({position:a}),e=new q,f=a,g=0,h=Q,i=R,l=S;d.addShape(e);for(var n=this.narrowphase,r=[],t=0,u=b.length;t!==u;t++)for(var v=b[t],w=0,x=v.shapes.length;w!==x;w++){var y=v.shapes[w],z=v.shapeOffsets[w]||i,A=v.shapeAngles[w]||0;j.rotate(h,z,v.angle),j.add(h,h,v.position);var B=A+v.angle;(y instanceof k&&n.circleParticle(v,y,h,B,d,e,f,g,!0)||y instanceof m&&n.particleConvex(d,e,f,g,v,y,h,B,!0)||y instanceof o&&n.particlePlane(d,e,f,g,v,y,h,B,!0)||y instanceof p&&n.particleCapsule(d,e,f,g,v,y,h,B,!0)||y instanceof q&&j.squaredLength(j.sub(l,h,a))<c*c)&&r.push(v)}return r},c.prototype.setGlobalEquationParameters=function(a){a=a||{};for(var b=0;b!==this.constraints.length;b++)for(var c=this.constraints[b],d=0;d!==c.equations.length;d++){var e=c.equations[d];"undefined"!=typeof a.stiffness&&(e.stiffness=a.stiffness),"undefined"!=typeof a.relaxation&&(e.relaxation=a.relaxation),e.needsUpdate=!0}for(var b=0;b!==this.contactMateria
}return b},loadPolygon:function(a,b,c){var d=this.game.cache.getPhysicsData(a,b);if(1===d.length){for(var e=[],f=d[d.length-1],g=0,h=f.shape.length;h>g;g+=2)e.push([f.shape[g],f.shape[g+1]]);return this.addPolygon(c,e)}for(var i=p2.vec2.create(),g=0;g<d.length;g++){for(var j=[],k=0;k<d[g].shape.length;k+=2)j.push([this.world.pxmi(d[g].shape[k]),this.world.pxmi(d[g].shape[k+1])]);for(var l=new p2.Convex(j),m=0;m!==l.vertices.length;m++){var n=l.vertices[m];p2.vec2.sub(n,n,l.centerOfMass)}p2.vec2.scale(i,l.centerOfMass,1),i[0]-=this.world.pxmi(this.sprite.width/2),i[1]-=this.world.pxmi(this.sprite.height/2),l.updateTriangles(),l.updateCenterOfMass(),l.updateBoundingRadius(),this.data.addShape(l,i)}return this.data.aabbNeedsUpdate=!0,this.shapeChanged(),!0},loadData:function(a,b,c){var d=this.game.cache.getPhysicsData(a,b);d&&d.shape&&(this.mass=d.density,this.loadPolygon(a,b,c))}},Phaser.Physics.P2.Body.prototype.constructor=Phaser.Physics.P2.Body,Phaser.Physics.P2.Body.DYNAMIC=1,Phaser.Physics.P2.Body.STATIC=2,Phaser.Physics.P2.Body.KINEMATIC=4,Object.defineProperty(Phaser.Physics.P2.Body.prototype,"static",{get:function(){return this.data.motionState===Phaser.Physics.P2.Body.STATIC},set:function(a){a&&this.data.motionState!==Phaser.Physics.P2.Body.STATIC?(this.data.motionState=Phaser.Physics.P2.Body.STATIC,this.mass=0):a||this.data.motionState!==Phaser.Physics.P2.Body.STATIC||(this.data.motionState=Phaser.Physics.P2.Body.DYNAMIC,0===this.mass&&(this.mass=1))}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"dynamic",{get:function(){return this.data.motionState===Phaser.Physics.P2.Body.DYNAMIC},set:function(a){a&&this.data.motionState!==Phaser.Physics.P2.Body.DYNAMIC?(this.data.motionState=Phaser.Physics.P2.Body.DYNAMIC,0===this.mass&&(this.mass=1)):a||this.data.motionState!==Phaser.Physics.P2.Body.DYNAMIC||(this.data.motionState=Phaser.Physics.P2.Body.STATIC,this.mass=0)}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"kinematic",{get:function(){return this.data.motionState===Phaser.Physics.P2.Body.KINEMATIC},set:function(a){a&&this.data.motionState!==Phaser.Physics.P2.Body.KINEMATIC?(this.data.motionState=Phaser.Physics.P2.Body.KINEMATIC,this.mass=4):a||this.data.motionState!==Phaser.Physics.P2.Body.KINEMATIC||(this.data.motionState=Phaser.Physics.P2.Body.STATIC,this.mass=0)}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"allowSleep",{get:function(){return this.data.allowSleep},set:function(a){a!==this.data.allowSleep&&(this.data.allowSleep=a)}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"angle",{get:function(){return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.data.angle))},set:function(a){this.data.angle=Phaser.Math.degToRad(Phaser.Math.wrapAngle(a))}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"angularDamping",{get:function(){return this.data.angularDamping},set:function(a){this.data.angularDamping=a}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"angularForce",{get:function(){return this.data.angularForce},set:function(a){this.data.angularForce=a}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"angularVelocity",{get:function(){return this.data.angularVelocity},set:function(a){this.data.angularVelocity=a}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"damping",{get:function(){return this.data.damping},set:function(a){this.data.damping=a}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"fixedRotation",{get:function(){return this.data.fixedRotation},set:function(a){a!==this.data.fixedRotation&&(this.data.fixedRotation=a)}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"inertia",{get:function(){return this.data.inertia},set:function(a){this.data.inertia=a}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"mass",{get:function(){return this.data.mass},set:function(a){a!==this.data.mass&&(this.data.mass=a,this.data.updateMassProperties())}}),Object.defineProperty(Phaser.Physics.P2.Body.prototype,"motionState",{get:function(){return this.data.motionState},set:function(a){a!==this.data.motionState&&(this.da