hey @yaustar
I have loaded ammo.wasm and js file yet i am seeing the same issue.
import {
Application as PcApplication,
RESOLUTION_AUTO,
FILLMODE_FILL_WINDOW,
Entity,
Color,
Vec3,
Mouse,
Keyboard,
RigidBodyComponentSystem,
WasmModule
} from 'playcanvas';
import { AssetLoader } from './AssetLoader.js';
import { debugLog } from '../utils/DebugLogger.js';
export class Application {
constructor() {
this.canvas = document.getElementById('application');
if (!this.canvas) {
debugLog('ERROR: Canvas element not found!');
throw new Error('Canvas element not found');
}
// Ensure canvas has non-zero size
this.resizeCanvas();
window.addEventListener('resize', () => this.resizeCanvas());
WasmModule.setConfig('Ammo', {
glueUrl: '/src/lib/ammo/ammo.wasm.js',
wasmUrl: '/src/lib/ammo/ammo.wasm.wasm',
fallbackUrl: '/src/lib/ammo/ammo.js'
});
WasmModule.getInstance('Ammo', () => {
console.log("Ammo.js loaded and ready to use.");
});
this.app = new PcApplication(this.canvas, {
mouse: new Mouse(this.canvas),
keyboard: new Keyboard(window)
});
this.app.setCanvasResolution(RESOLUTION_AUTO);
this.app.setCanvasFillMode(FILLMODE_FILL_WINDOW);
this.app.systems.add(RigidBodyComponentSystem);
this.app.systems.rigidbody.gravity.set(0, -9.81, 0);
this.assetLoader = new AssetLoader(this.app);
this.setupLights();
}
resizeCanvas() {
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
}
start() {
this.app.start();
}
setupLights() {
this.createLight('directional', 0.6, new Vec3(0, 10, 0), new Vec3(45, 45, 0));
this.createLight('point', 0.7, new Vec3(0, 5, 0));
this.createLight('point', 0.7, new Vec3(5, 5, 5));
this.createLight('point', 0.7, new Vec3(-5, 5, -5));
}
createLight(type, intensity, position, rotation) {
const light = new Entity();
light.addComponent('light', {
type: type,
color: new Color(1, 1, 1),
intensity: intensity,
range: 20,
shadowDistance: 30,
shadowResolution: 1024,
shadowBias: 0.2,
normalOffsetBias: 0.05
});
light.setPosition(position.x, position.y, position.z);
if (rotation) {
light.setEulerAngles(rotation.x, rotation.y, rotation.z);
}
this.app.root.addChild(light);
return light;
}
getCanvas() {
return this.canvas;
}
}
Am I doing something wrong ?