How can i properly create a custom engine IN TYPESCRIPT so i can set legact V1 audioEngine = true;
Note: this following only seems to work with javascript:
var createEngine = async function () {
console.log("GOT HERE");
const canvas = document.getElementById("renderCanvas") as HTMLCanvasElement;
const opts: BABYLON.EngineOptions = {
audioEngine: true, // Legacy V1 Audio
};
// WebGPU if available
if ((navigator as any).gpu) {
const e = new BABYLON.WebGPUEngine(canvas, opts as any);
await e.initAsync();
return e;
}
// WebGL fallback
return new BABYLON.Engine(canvas, true, opts, false);
};
I tried:
public static async CreateEngine(canvas: HTMLCanvasElement, engineOptions: BABYLON.EngineOptions = { audioEngine: true }): Promise<BABYLON.AbstractEngine> {
console.warn("@@@ CreateEngine...");
// Prefer WebGPU if available in the browser
if ((navigator as any).gpu) {
const webgpu = new BABYLON.WebGPUEngine(canvas, engineOptions as any);
await webgpu.initAsync();
return webgpu;
}
// Fallback to WebGL
return new BABYLON.Engine(canvas, true, engineOptions);
}
Appearently there are issues with V2 Audio Engine and mutiple StaticSounds that have spatial enabled… Only One truly respects the maxDistance, when listenerAutoUpdate = true and spatialAutoUpdate = true
Nothing seems to work for create custom engine with TypeScript ![]()