I'm currently working on a project involving physijs, but I keep encountering a specific error in Mozilla Firefox console:
- NetworkError: Failed to load worker script at "js/libs/ammo.js"
https://i.sstatic.net/C41T8.png
I've been trying to troubleshoot this issue without much success. Here's the snippet of code related to my physijs setup:
<script src="build/three.js"></script>
<script src="js/libs/physi.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/Detector.js"></script>
<script>
'use strict';
Physijs.scripts.worker = 'js/libs/physijs_worker.js';
Physijs.scripts.ammo = 'js/libs/ammo.js';
All javascript files are located in the js directory except for Three.js building files which are in the build directory. Despite following the proper structure, I can't seem to figure out why my code isn't working as expected. I have set up lights, ground, and objects adhering to the rules of Physijs, but I'm facing difficulties, especially with applying constraints.
Here is the initialization code for the scene that I am using:
function createScene() {
var container = document.getElementById( 'container' );
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.x = 0;
camera.position.z = 17;
camera.position.y = 12;
scene = new Physijs.Scene;
scene.setGravity(new THREE.Vector3( 0, -10, 0 ));
// Other rendering configurations...
}
I'm seeking assistance on resolving the import issue with Physi.js. How can I successfully address this problem?