Skip to content

Commit e3d7c0c

Browse files
committed
updated build
1 parent 4d6eec1 commit e3d7c0c

File tree

2 files changed

+80
-17
lines changed

2 files changed

+80
-17
lines changed

build/cannon.js

+76-13
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module.exports = {
101101
Quaternion : _dereq_('./math/Quaternion'),
102102
Ray : _dereq_('./collision/Ray'),
103103
RaycastVehicle : _dereq_('./objects/RaycastVehicle'),
104+
RaycastResult : _dereq_('./collision/RaycastResult'),
104105
RigidVehicle : _dereq_('./objects/RigidVehicle'),
105106
RotationalEquation : _dereq_('./equations/RotationalEquation'),
106107
RotationalMotorEquation : _dereq_('./equations/RotationalMotorEquation'),
@@ -116,7 +117,7 @@ module.exports = {
116117
World : _dereq_('./world/World'),
117118
};
118119

119-
},{"../package.json":1,"./collision/ArrayCollisionMatrix":4,"./collision/Broadphase":5,"./collision/GridBroadphase":6,"./collision/NaiveBroadphase":7,"./collision/ObjectCollisionMatrix":8,"./collision/Ray":9,"./collision/SAPBroadphase":11,"./constraints/Constraint":12,"./constraints/DistanceConstraint":13,"./constraints/HingeConstraint":14,"./constraints/PointToPointConstraint":15,"./equations/ContactEquation":16,"./equations/Equation":17,"./equations/FrictionEquation":18,"./equations/RotationalEquation":19,"./equations/RotationalMotorEquation":20,"./material/ContactMaterial":21,"./material/Material":22,"./math/Mat3":24,"./math/Quaternion":25,"./math/Vec3":27,"./objects/Body":28,"./objects/RaycastVehicle":29,"./objects/RigidVehicle":30,"./objects/SPHSystem":31,"./objects/Spring":32,"./shapes/Box":34,"./shapes/ConvexPolyhedron":35,"./shapes/Cylinder":36,"./shapes/Heightfield":37,"./shapes/Particle":38,"./shapes/Plane":39,"./shapes/Shape":40,"./shapes/Sphere":41,"./solver/GSSolver":42,"./solver/Solver":43,"./solver/SplitSolver":44,"./utils/EventTarget":45,"./utils/Pool":46,"./utils/Vec3Pool":49,"./world/Narrowphase":50,"./world/World":51}],3:[function(_dereq_,module,exports){
120+
},{"../package.json":1,"./collision/ArrayCollisionMatrix":4,"./collision/Broadphase":5,"./collision/GridBroadphase":6,"./collision/NaiveBroadphase":7,"./collision/ObjectCollisionMatrix":8,"./collision/Ray":9,"./collision/RaycastResult":10,"./collision/SAPBroadphase":11,"./constraints/Constraint":12,"./constraints/DistanceConstraint":13,"./constraints/HingeConstraint":14,"./constraints/PointToPointConstraint":15,"./equations/ContactEquation":16,"./equations/Equation":17,"./equations/FrictionEquation":18,"./equations/RotationalEquation":19,"./equations/RotationalMotorEquation":20,"./material/ContactMaterial":21,"./material/Material":22,"./math/Mat3":24,"./math/Quaternion":25,"./math/Vec3":27,"./objects/Body":28,"./objects/RaycastVehicle":29,"./objects/RigidVehicle":30,"./objects/SPHSystem":31,"./objects/Spring":32,"./shapes/Box":34,"./shapes/ConvexPolyhedron":35,"./shapes/Cylinder":36,"./shapes/Heightfield":37,"./shapes/Particle":38,"./shapes/Plane":39,"./shapes/Shape":40,"./shapes/Sphere":41,"./solver/GSSolver":42,"./solver/Solver":43,"./solver/SplitSolver":44,"./utils/EventTarget":45,"./utils/Pool":46,"./utils/Vec3Pool":49,"./world/Narrowphase":50,"./world/World":51}],3:[function(_dereq_,module,exports){
120121
var Vec3 = _dereq_('../math/Vec3');
121122
var Utils = _dereq_('../utils/Utils');
122123

@@ -483,12 +484,7 @@ Broadphase.prototype.doBoundingBoxBroadphase = function(bi,bj,pairs1,pairs2){
483484
}
484485

485486
// Check AABB / AABB
486-
if( !( bi.aabb.upperBound.x < bj.aabb.lowerBound.x ||
487-
bi.aabb.upperBound.y < bj.aabb.lowerBound.y ||
488-
bi.aabb.upperBound.z < bj.aabb.lowerBound.z ||
489-
bi.aabb.lowerBound.x > bj.aabb.upperBound.x ||
490-
bi.aabb.lowerBound.y > bj.aabb.upperBound.y ||
491-
bi.aabb.lowerBound.z > bj.aabb.upperBound.z ) ){
487+
if(bi.aabb.overlaps(bj.aabb)){
492488
pairs1.push(bi);
493489
pairs2.push(bj);
494490
}
@@ -1657,7 +1653,7 @@ SAPBroadphase.prototype.collisionPairs = function(world,p1,p2){
16571653
break;
16581654
}
16591655

1660-
this.doBoundingSphereBroadphase(bi,bj,p1,p2);
1656+
this.intersectionTest(bi,bj,p1,p2);
16611657
}
16621658
}
16631659
};
@@ -6945,11 +6941,40 @@ Box.prototype.forEachWorldCorner = function(pos,quat,callback){
69456941
}
69466942
};
69476943

6944+
var worldCornersTemp = [
6945+
new Vec3(),
6946+
new Vec3(),
6947+
new Vec3(),
6948+
new Vec3(),
6949+
new Vec3(),
6950+
new Vec3(),
6951+
new Vec3(),
6952+
new Vec3()
6953+
];
69486954
Box.prototype.calculateWorldAABB = function(pos,quat,min,max){
6949-
// Get each axis max
6950-
min.set(Infinity,Infinity,Infinity);
6951-
max.set(-Infinity,-Infinity,-Infinity);
6952-
this.forEachWorldCorner(pos,quat,function(x,y,z){
6955+
6956+
var e = this.halfExtents;
6957+
worldCornersTemp[0].set(e.x, e.y, e.z);
6958+
worldCornersTemp[1].set(-e.x, e.y, e.z);
6959+
worldCornersTemp[2].set(-e.x, -e.y, e.z);
6960+
worldCornersTemp[3].set(-e.x, -e.y, -e.z);
6961+
worldCornersTemp[4].set(e.x, -e.y, -e.z);
6962+
worldCornersTemp[5].set(e.x, e.y, -e.z);
6963+
worldCornersTemp[6].set(-e.x, e.y, -e.z);
6964+
worldCornersTemp[7].set(e.x, -e.y, e.z);
6965+
6966+
var wc = worldCornersTemp[0];
6967+
quat.vmult(wc, wc);
6968+
pos.vadd(wc, wc);
6969+
max.copy(wc);
6970+
min.copy(wc);
6971+
for(var i=1; i<8; i++){
6972+
var wc = worldCornersTemp[i];
6973+
quat.vmult(wc, wc);
6974+
pos.vadd(wc, wc);
6975+
var x = wc.x;
6976+
var y = wc.y;
6977+
var z = wc.z;
69536978
if(x > max.x){
69546979
max.x = x;
69556980
}
@@ -6969,7 +6994,32 @@ Box.prototype.calculateWorldAABB = function(pos,quat,min,max){
69696994
if(z < min.z){
69706995
min.z = z;
69716996
}
6972-
});
6997+
}
6998+
6999+
// Get each axis max
7000+
// min.set(Infinity,Infinity,Infinity);
7001+
// max.set(-Infinity,-Infinity,-Infinity);
7002+
// this.forEachWorldCorner(pos,quat,function(x,y,z){
7003+
// if(x > max.x){
7004+
// max.x = x;
7005+
// }
7006+
// if(y > max.y){
7007+
// max.y = y;
7008+
// }
7009+
// if(z > max.z){
7010+
// max.z = z;
7011+
// }
7012+
7013+
// if(x < min.x){
7014+
// min.x = x;
7015+
// }
7016+
// if(y < min.y){
7017+
// min.y = y;
7018+
// }
7019+
// if(z < min.z){
7020+
// min.z = z;
7021+
// }
7022+
// });
69737023
};
69747024

69757025
},{"../math/Vec3":27,"./ConvexPolyhedron":35,"./Shape":40}],35:[function(_dereq_,module,exports){
@@ -9430,6 +9480,10 @@ Narrowphase.prototype.getContacts = function(p1,p2,world,result,oldcontacts){
94309480
xj.vadd(bj.position, xj);
94319481
var sj = bj.shapes[j];
94329482

9483+
if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){
9484+
break;
9485+
}
9486+
94339487
// Get contacts
94349488
var resolver = this[si.type | sj.type];
94359489
if(resolver){
@@ -10020,6 +10074,10 @@ Narrowphase.prototype.sphereConvex = function(result,si,sj,xi,xj,qi,qj,bi,bj){
1002010074
var R = si.radius;
1002110075
var penetrating_sides = [];
1002210076

10077+
if(convex_to_sphere.norm2() > si.boundingSphereRadius + sj.boundingSphereRadius){
10078+
return;
10079+
}
10080+
1002310081
// Check corners
1002410082
for(var i=0; i!==verts.length; i++){
1002510083
var v = verts[i];
@@ -10321,6 +10379,11 @@ var convexConvex_q = new Vec3();
1032110379
Narrowphase.prototype[Shape.types.CONVEXPOLYHEDRON] =
1032210380
Narrowphase.prototype.convexConvex = function(result,si,sj,xi,xj,qi,qj,bi,bj,rsi,rsj){
1032310381
var sepAxis = convexConvex_sepAxis;
10382+
10383+
if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){
10384+
return;
10385+
}
10386+
1032410387
if(si.findSeparatingAxis(sj,xi,qi,xj,qj,sepAxis)){
1032510388
var res = [];
1032610389
var q = convexConvex_q;

0 commit comments

Comments
 (0)