|
@@ -1061,19 +1061,21 @@
|
|
|
};
|
|
|
|
|
|
// Collisions
|
|
|
- Scene.prototype._getNewPosition = function (position, velocity, collider, maximumRetry, finalPosition) {
|
|
|
+ Scene.prototype._getNewPosition = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
|
|
|
+ if (typeof excludedMesh === "undefined") { excludedMesh = null; }
|
|
|
position.divideToRef(collider.radius, this._scaledPosition);
|
|
|
velocity.divideToRef(collider.radius, this._scaledVelocity);
|
|
|
|
|
|
collider.retry = 0;
|
|
|
collider.initialVelocity = this._scaledVelocity;
|
|
|
collider.initialPosition = this._scaledPosition;
|
|
|
- this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, finalPosition);
|
|
|
+ this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, finalPosition, excludedMesh);
|
|
|
|
|
|
finalPosition.multiplyInPlace(collider.radius);
|
|
|
};
|
|
|
|
|
|
- Scene.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition) {
|
|
|
+ Scene.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
|
|
|
+ if (typeof excludedMesh === "undefined") { excludedMesh = null; }
|
|
|
var closeDistance = BABYLON.Engine.CollisionsEpsilon * 10.0;
|
|
|
|
|
|
if (collider.retry >= maximumRetry) {
|
|
@@ -1085,7 +1087,7 @@
|
|
|
|
|
|
for (var index = 0; index < this.meshes.length; index++) {
|
|
|
var mesh = this.meshes[index];
|
|
|
- if (mesh.isEnabled() && mesh.checkCollisions) {
|
|
|
+ if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh) {
|
|
|
mesh._checkCollision(collider);
|
|
|
}
|
|
|
}
|
|
@@ -1105,7 +1107,7 @@
|
|
|
}
|
|
|
|
|
|
collider.retry++;
|
|
|
- this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition);
|
|
|
+ this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
|
|
|
};
|
|
|
|
|
|
// Octrees
|