I want to load a 3D *.glb file with babylonjs from a hidden file path like this
<html>
<head>
<title>Babylon.js Viewer - Display a 3D model</title>
<script src="https://cdn.babylonjs.com/viewer/babylon.viewer.js"></script>
</head>
<body>
<babylon model="https://example.com/view.php?id=blablabla.glb" templates.main.params.fill-screen="true"></babylon>
</body>
</html>
view.php
<?php
if ($_GET['id'] != "blablabla.glb") {
exit();
}
$file = '3dmodel.glb';
if (file_exists($file)) {
header('Content-type: model/gltf-binary');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
ob_clean();
flush();
readfile($file);
exit;
}
?>
I got this error from the console "Load Error: There was an error loading the model. Unable to load from https://example.com/view.php?id=blablabla.glb: importMesh of undefined from undefined version: undefined, exporter version: undefined importMesh has failed JSON parse"
please help me, thanks.
glbfile exist in the same directory asindex.php?