kinometal

Use the viewer for simple 3D rotation product in web (error)

Recommended Posts

 

Hello to all :)

Im noob with Babylon and i have a problem when i try to test one object exported from Blender.

I will use the viewer for simply 3D rotation in online shop for see the product. The official test from viewer (boombox.glb) works fine in my computer without problem.

When I try to test my 3D objects exported from Blender in Babylon Editor or in SandBox i dont have a problem, I can see the object correctly, but when I try to execute in local or in website, no run, no work the viewer, freeze the screen in the square pre loader :(

Im reading and try a lot of configs but i dont solve it.

The code im using is the example of the test viewer, and I change the "boombox.glb" for my object exported from Blender in stl, glb or .babylon extension, but not work in any:

<html>
<head>
  <title>Babylon.js Viewer - Display a 3D model</title>
  <script src="https://preview.babylonjs.com/viewer/babylon.viewer.js"></script> 
</head>
<body>
    <babylon model="https://models.babylonjs.com/boombox.glb" templates.main.params.fill-screen="true"></babylon>
</body>
</html>

In the debug appear this error: babylon.viewer.js:19 BJS - [16:59:48]: No URL provided
t._ErrorEnabled @ babylon.viewer.js:19

Thank you for your help,

Kino

Share this post


Link to post
Share on other sites

im not expert  in standalone html js usage with babylonjs

but.... it says clearly that u didnt specify the correct url in the js file u want html to load...

so show us the viewer.js file instead on line 19 u find the error😇

i checked fast to just check i found this

<script src="https://cdn.babylonjs.com/viewer/babylon.viewer.js"></script>

 

Share this post


Link to post
Share on other sites

no everything works for me in localhost.

Your problem is that u give us 2 files that doesnt even belong in the code

u need to change the model url to ur file.

and it should work

ur files doesnt work i tested it try a glb file the example works though

i tried babylon file with a skull it works perfecet ur file is either not accible or corrupt

Share this post


Link to post
Share on other sites

try have the file locally on the server and make model object point to the correct path...

the line code 19 is on babulon server and not accesible i guess.

I think ur case u need to have a valid file.

 

Share this post


Link to post
Share on other sites

I updated the path and now appears this error: "Error loading the model".

In the debugger appears now: Access to XMLHttpRequest at 'http://carpas.net/3d/brezza.stl' from origin 'http://www.carpas.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Share this post


Link to post
Share on other sites

yea follow deltakosh i dont think u know very much if u have cors problem its not really related to babylonjs.....

i think u need easiest way is to upload file somewhere else.

i doubt u can easy fix problem on ur own

cor problem is fixed by sending headers in ur request or by allowing loxalhost42000 in server file

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.