I used exactly the same code, only now incorporated into a child theme. All scripts are loaded and get this error message:
BJS: Unable to load from …/wp-content/themes/salient-child/js/rocket.glb: Error in onSuccess callback: TypeError: Cannot set properties of null (setting ‘hidden’)
I believe it is due to some of your Wordpress settings - or, even more possible, due to some of JS frameworks settings.
Try to use absolute URL and see what will happen.
You mean this url
BABYLON.SceneLoader.ImportMesh(null, “…/wp-content/themes/salient-child/js/”, “rocket.glb”, scene, function(newMeshes) {
To this:
BABYLON.SceneLoader.ImportMesh(null, “…/wp-content/themes/salient-child/js/rocket.glb”, scene, function(newMeshes) {
But then I get this error message:
sceneLoader.ts:657 Uncaught TypeError: s.substr is not a function
at e._GetFileInfo (sceneLoader.ts:657:26)
at e.ImportMesh (sceneLoader.ts:745:38)
at createScene (sam.js?ver=6.3.1:18:33)
at sam.js?ver=6.3.1:186:17
Absolute URL looks like http://www.example.com/xyz.html
I believe that after you’ve switched to child theme (and the model stopped to load) some of your (relative) pointers become wrong.
So, you already have the working version and it stops to work with the child theme. The reason “why” has nothing to do with Babylon, this is Wordpress and the specific use problem… Hope you’l find your rocket even in the child theme!