Skip to content

Commit 4cc18e2

Browse files
committed
Phaser 3.0.0 Beta 1 release.
1 parent 6402554 commit 4cc18e2

34 files changed

Lines changed: 9071 additions & 113421 deletions

build/creature.js

Lines changed: 0 additions & 7207 deletions
This file was deleted.

build/creature.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/creature.min.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

build/custom/p2.js

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ module.exports = {
689689
},{"./Point":2,"./Polygon":3}],6:[function(_dereq_,module,exports){
690690
module.exports={
691691
"name": "p2",
692-
"version": "0.7.0",
692+
"version": "0.7.1",
693693
"description": "A JavaScript 2D physics engine.",
694694
"author": "Stefan Hedman <schteppe@gmail.com> (http://steffe.se)",
695695
"keywords": [
@@ -725,7 +725,7 @@ module.exports={
725725
"grunt-contrib-concat": "^0.4.0"
726726
},
727727
"dependencies": {
728-
"poly-decomp": "0.1.0"
728+
"poly-decomp": "0.1.1"
729729
}
730730
}
731731

@@ -5760,6 +5760,23 @@ ContactEquation.prototype.computeB = function(a,b,h){
57605760
return B;
57615761
};
57625762

5763+
var vi = vec2.create();
5764+
var vj = vec2.create();
5765+
var relVel = vec2.create();
5766+
5767+
/**
5768+
* Get the relative velocity along the normal vector.
5769+
* @return {number}
5770+
*/
5771+
ContactEquation.prototype.getVelocityAlongNormal = function(){
5772+
5773+
this.bodyA.getVelocityAtPoint(vi, this.contactPointA);
5774+
this.bodyB.getVelocityAtPoint(vj, this.contactPointB);
5775+
5776+
vec2.subtract(relVel, vi, vj);
5777+
5778+
return vec2.dot(this.normalA, relVel);
5779+
};
57635780
},{"../math/vec2":30,"./Equation":22}],22:[function(_dereq_,module,exports){
57645781
module.exports = Equation;
57655782

@@ -6433,52 +6450,55 @@ function ContactMaterial(materialA, materialB, options){
64336450
this.materialB = materialB;
64346451

64356452
/**
6436-
* Friction to use in the contact of these two materials
6453+
* Friction coefficient to use in the contact of these two materials. Friction = 0 will make the involved objects super slippery, and friction = 1 will make it much less slippery. A friction coefficient larger than 1 will allow for very large friction forces, which can be convenient for preventing car tires not slip on the ground.
64376454
* @property friction
64386455
* @type {Number}
6456+
* @default 0.3
64396457
*/
6440-
this.friction = typeof(options.friction) !== "undefined" ? Number(options.friction) : 0.3;
6458+
this.friction = typeof(options.friction) !== "undefined" ? Number(options.friction) : 0.3;
64416459

64426460
/**
6443-
* Restitution to use in the contact of these two materials
6461+
* Restitution, or "bounciness" to use in the contact of these two materials. A restitution of 0 will make no bounce, while restitution=1 will approximately bounce back with the same velocity the object came with.
64446462
* @property restitution
64456463
* @type {Number}
6464+
* @default 0
64466465
*/
6447-
this.restitution = typeof(options.restitution) !== "undefined" ? Number(options.restitution) : 0.0;
6466+
this.restitution = typeof(options.restitution) !== "undefined" ? Number(options.restitution) : 0;
64486467

64496468
/**
6450-
* Stiffness of the resulting ContactEquation that this ContactMaterial generate
6469+
* Hardness of the contact. Less stiffness will make the objects penetrate more, and will make the contact act more like a spring than a contact force. Default value is {{#crossLink "Equation/DEFAULT_STIFFNESS:property"}}Equation.DEFAULT_STIFFNESS{{/crossLink}}.
64516470
* @property stiffness
64526471
* @type {Number}
64536472
*/
6454-
this.stiffness = typeof(options.stiffness) !== "undefined" ? Number(options.stiffness) : Equation.DEFAULT_STIFFNESS;
6473+
this.stiffness = typeof(options.stiffness) !== "undefined" ? Number(options.stiffness) : Equation.DEFAULT_STIFFNESS;
64556474

64566475
/**
6457-
* Relaxation of the resulting ContactEquation that this ContactMaterial generate
6476+
* Relaxation of the resulting ContactEquation that this ContactMaterial generate. Default value is {{#crossLink "Equation/DEFAULT_RELAXATION:property"}}Equation.DEFAULT_RELAXATION{{/crossLink}}.
64586477
* @property relaxation
64596478
* @type {Number}
64606479
*/
6461-
this.relaxation = typeof(options.relaxation) !== "undefined" ? Number(options.relaxation) : Equation.DEFAULT_RELAXATION;
6480+
this.relaxation = typeof(options.relaxation) !== "undefined" ? Number(options.relaxation) : Equation.DEFAULT_RELAXATION;
64626481

64636482
/**
6464-
* Stiffness of the resulting FrictionEquation that this ContactMaterial generate
6483+
* Stiffness of the resulting friction force. For most cases, the value of this property should be a large number. I cannot think of any case where you would want less frictionStiffness. Default value is {{#crossLink "Equation/DEFAULT_STIFFNESS:property"}}Equation.DEFAULT_STIFFNESS{{/crossLink}}.
64656484
* @property frictionStiffness
64666485
* @type {Number}
64676486
*/
6468-
this.frictionStiffness = typeof(options.frictionStiffness) !== "undefined" ? Number(options.frictionStiffness) : Equation.DEFAULT_STIFFNESS;
6487+
this.frictionStiffness = typeof(options.frictionStiffness) !== "undefined" ? Number(options.frictionStiffness) : Equation.DEFAULT_STIFFNESS;
64696488

64706489
/**
6471-
* Relaxation of the resulting FrictionEquation that this ContactMaterial generate
6490+
* Relaxation of the resulting friction force. The default value should be good for most simulations. Default value is {{#crossLink "Equation/DEFAULT_RELAXATION:property"}}Equation.DEFAULT_RELAXATION{{/crossLink}}.
64726491
* @property frictionRelaxation
64736492
* @type {Number}
64746493
*/
6475-
this.frictionRelaxation = typeof(options.frictionRelaxation) !== "undefined" ? Number(options.frictionRelaxation) : Equation.DEFAULT_RELAXATION;
6494+
this.frictionRelaxation = typeof(options.frictionRelaxation) !== "undefined" ? Number(options.frictionRelaxation) : Equation.DEFAULT_RELAXATION;
64766495

64776496
/**
64786497
* Will add surface velocity to this material. If bodyA rests on top if bodyB, and the surface velocity is positive, bodyA will slide to the right.
64796498
* @property {Number} surfaceVelocity
6499+
* @default 0
64806500
*/
6481-
this.surfaceVelocity = typeof(options.surfaceVelocity) !== "undefined" ? Number(options.surfaceVelocity) : 0;
6501+
this.surfaceVelocity = typeof(options.surfaceVelocity) !== "undefined" ? Number(options.surfaceVelocity) : 0;
64826502

64836503
/**
64846504
* Offset to be set on ContactEquations. A positive value will make the bodies penetrate more into each other. Can be useful in scenes where contacts need to be more persistent, for example when stacking. Aka "cure for nervous contacts".
@@ -8224,7 +8244,7 @@ Body.prototype.applyForce = function(force, relativePoint){
82248244
* Apply force to a body-local point.
82258245
* @method applyForceLocal
82268246
* @param {Array} localForce The force vector to add, oriented in local body space.
8227-
* @param {Array} localPoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
8247+
* @param {Array} [localPoint] A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
82288248
*/
82298249
var Body_applyForce_forceWorld = vec2.create();
82308250
var Body_applyForce_pointWorld = vec2.create();
@@ -10619,42 +10639,42 @@ Plane.prototype.updateBoundingRadius = function(){
1061910639
Plane.prototype.computeAABB = function(out, position, angle){
1062010640
var a = angle % (2 * Math.PI);
1062110641
var set = vec2.set;
10622-
var max = Number.MAX_VALUE;
10642+
var max = 1e7;
1062310643
var lowerBound = out.lowerBound;
1062410644
var upperBound = out.upperBound;
1062510645

10646+
// Set max bounds
10647+
set(lowerBound, -max, -max);
10648+
set(upperBound, max, max);
10649+
1062610650
if(a === 0){
1062710651
// y goes from -inf to 0
10628-
set(lowerBound, -max, -max);
10629-
set(upperBound, max, 0);
10652+
upperBound[1] = 0;
10653+
// set(lowerBound, -max, -max);
10654+
// set(upperBound, max, 0);
1063010655

1063110656
} else if(a === Math.PI / 2){
1063210657

1063310658
// x goes from 0 to inf
10634-
set(lowerBound, 0, -max);
10635-
set(upperBound, max, max);
10659+
lowerBound[0] = 0;
10660+
// set(lowerBound, 0, -max);
10661+
// set(upperBound, max, max);
1063610662

1063710663
} else if(a === Math.PI){
1063810664

1063910665
// y goes from 0 to inf
10640-
set(lowerBound, -max, 0);
10641-
set(upperBound, max, max);
10666+
lowerBound[1] = 0;
10667+
// set(lowerBound, -max, 0);
10668+
// set(upperBound, max, max);
1064210669

1064310670
} else if(a === 3*Math.PI/2){
1064410671

1064510672
// x goes from -inf to 0
10646-
set(lowerBound, -max, -max);
10647-
set(upperBound, 0, max);
10648-
10649-
} else {
10673+
upperBound[0] = 0;
10674+
// set(lowerBound, -max, -max);
10675+
// set(upperBound, 0, max);
1065010676

10651-
// Set max bounds
10652-
set(lowerBound, -max, -max);
10653-
set(upperBound, max, max);
1065410677
}
10655-
10656-
vec2.add(lowerBound, lowerBound, position);
10657-
vec2.add(upperBound, upperBound, position);
1065810678
};
1065910679

1066010680
Plane.prototype.updateArea = function(){
@@ -11000,16 +11020,20 @@ function GSSolver(options){
1100011020
* Set to true to set all right hand side terms to zero when solving. Can be handy for a few applications.
1100111021
* @property useZeroRHS
1100211022
* @type {Boolean}
11023+
* @todo Remove, not used
1100311024
*/
1100411025
this.useZeroRHS = false;
1100511026

1100611027
/**
11007-
* Number of solver iterations that are done to approximate normal forces. When these iterations are done, friction force will be computed from the contact normal forces. These friction forces will override any other friction forces set from the World for example.
11008-
* The solver will use less iterations if the solution is below the .tolerance.
11028+
* Number of solver iterations that are used to approximate normal forces used for friction (F_friction = mu * F_normal). These friction forces will override any other friction forces that are set. If you set frictionIterations = 0, then this feature will be disabled.
11029+
*
11030+
* Use only frictionIterations > 0 if the approximated normal force (F_normal = mass * gravity) is not good enough. Examples of where it can happen is in space games where gravity is zero, or in tall stacks where the normal force is large at bottom but small at top.
11031+
*
1100911032
* @property frictionIterations
1101011033
* @type {Number}
11034+
* @default 0
1101111035
*/
11012-
this.frictionIterations = 0;
11036+
this.frictionIterations = options.frictionIterations !== undefined ? 0 : options.frictionIterations;
1101311037

1101411038
/**
1101511039
* The number of iterations that were made during the last solve. If .tolerance is zero, this value will always be equal to .iterations, but if .tolerance is larger than zero, and the solver can quit early, then this number will be somewhere between 1 and .iterations.
@@ -13450,6 +13474,7 @@ var hitTest_tmp1 = vec2.create(),
1345013474
* @return {Array} Array of bodies that overlap the point
1345113475
* @todo Should use an api similar to the raycast function
1345213476
* @todo Should probably implement a .containsPoint method for all shapes. Would be more efficient
13477+
* @todo Should use the broadphase
1345313478
*/
1345413479
World.prototype.hitTest = function(worldPoint,bodies,precision){
1345513480
precision = precision || 0;

build/custom/p2.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/p2.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)