|
@@ -416,6 +416,7 @@
|
|
else {
|
|
else {
|
|
var stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
var stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
this._soundSource.stop(stopTime);
|
|
this._soundSource.stop(stopTime);
|
|
|
|
+ this._soundSource.onended = null;
|
|
if (!this.isPaused) {
|
|
if (!this.isPaused) {
|
|
this._startOffset = 0;
|
|
this._startOffset = 0;
|
|
}
|
|
}
|
|
@@ -486,6 +487,14 @@
|
|
meshToConnectTo.registerAfterWorldMatrixUpdate(this._registerFunc);
|
|
meshToConnectTo.registerAfterWorldMatrixUpdate(this._registerFunc);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public detachFromMesh() {
|
|
|
|
+ if (this._connectedMesh) {
|
|
|
|
+ this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
|
|
|
|
+ this._registerFunc = null;
|
|
|
|
+ this._connectedMesh = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private _onRegisterAfterWorldMatrixUpdate(connectedMesh: AbstractMesh) {
|
|
private _onRegisterAfterWorldMatrixUpdate(connectedMesh: AbstractMesh) {
|
|
this.setPosition(connectedMesh.getBoundingInfo().boundingSphere.centerWorld);
|
|
this.setPosition(connectedMesh.getBoundingInfo().boundingSphere.centerWorld);
|
|
if (Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
|
|
if (Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
|