Jump to content

Babylon Viewer Issue


freetoplay
 Share

Recommended Posts

Hi, I am playing around with the Viewer, but when I load models, everything appears really zoomed in.

I am using this code:

 

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>BabylonJS Viewer - Basic usage</title>
        <style>
            babylon {
                width: 100%;
                height: 600px;
            }
        </style>
    </head>

    <body>
        <babylon model="./character.glb"></babylon>
        <script src="https://viewer.babylonjs.com/viewer.min.js"></script>
    </body>

</html>

Do I have to manually adjust the camera to zoom out?

Link to comment
Share on other sites

First viewer question! awesome!

The simplest solution for this is to normalize the model. This will keep the model in perspective while making sure the camera's zoom factors. Try this:

<babylon model.normalize="true" model.url="./character.glb"></babylon>

You can also set the scaling of the model if you want:


<babylon>
  <model url="./character.glb">
    <scaling x="10" y="10" z="10"></scaling>
  </model>
</babylon>

You can also use the "extended" configuration, which adds a lot of configuration elements, including light, camera configuration and behaviors, better PBR support,  environment definitions and more. to use that do this:

<babylon extends="extended" model="./character.glb"></babylon>

Let me know if this helped!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...