|
@@ -368,13 +368,18 @@ export class Collider {
|
|
|
var distToCollision = t * this._velocity.length();
|
|
|
|
|
|
if (!this.collisionFound || distToCollision < this._nearestDistance) {
|
|
|
- if (!this.intersectionPoint) {
|
|
|
- this.intersectionPoint = this._collisionPoint.clone();
|
|
|
- } else {
|
|
|
- this.intersectionPoint.copyFrom(this._collisionPoint);
|
|
|
+ // if collisionResponse is false, collision is not found but the collidedMesh is set anyway.
|
|
|
+ // onCollide observable are triggered if collideMesh is set
|
|
|
+ // this allow trigger volumes to be created.
|
|
|
+ if (hostMesh.collisionResponse) {
|
|
|
+ if (!this.intersectionPoint) {
|
|
|
+ this.intersectionPoint = this._collisionPoint.clone();
|
|
|
+ } else {
|
|
|
+ this.intersectionPoint.copyFrom(this._collisionPoint);
|
|
|
+ }
|
|
|
+ this._nearestDistance = distToCollision;
|
|
|
+ this.collisionFound = true;
|
|
|
}
|
|
|
- this._nearestDistance = distToCollision;
|
|
|
- this.collisionFound = true;
|
|
|
this.collidedMesh = hostMesh;
|
|
|
}
|
|
|
}
|