Jump to content

babylonjs zoom


mout99
 Share

Recommended Posts

Hello, I have a scene and its zoom is very slow, how do I increase? (The zoom of the mouse scroll and the zoom with the fingers in the mobile)
           if (BABYLON.Engine.isSupported()) {
             var canvas = document.getElementById("renderCanvas");
             var engine = new BABYLON.Engine(canvas, true);
             var newScene;

             BABYLON.SceneLoader.Load("", "js/teste.obj", engine, function (newScene) {
                 newScene.executeWhenReady(function () {
                    var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0, 0, BABYLON.Vector3.Zero(), newScene);
                    camera.setPosition(new BABYLON.Vector3(7500,7500,7500));
                    camera.attachControl(canvas, true);
                    camera.maxZ = 0;
                    camera.pinchPrecision = 30;
                    newScene.activeCamera = camera;
                    newScene.activeCamera.attachControl(canvas, true);
                    newScene.clearColor = new BABYLON.Color3(0.5, 0.8, 0.5);


                     engine.runRenderLoop(function() {
                        newScene.render();
                     });

                 });
             },function (progress) {
             });

           }
           window.addEventListener("resize", function () {
            engine.resize();
        });

 

Link to comment
Share on other sites

           if (BABYLON.Engine.isSupported()) {
             var canvas = document.getElementById("renderCanvas");
             var engine = new BABYLON.Engine(canvas, true);
             var newScene;

             BABYLON.SceneLoader.Load("", "js/teste.obj", engine, function (newScene) {
                 newScene.executeWhenReady(function () {
                  var camera = new BABYLON.ArcRotateCamera("camera", 4.712, 1.571, 0.05, BABYLON.Vector3.Zero(), newScene);
                   newScene.activeCamera = camera;
                   camera.attachControl(canvas, true);
                    camera.setPosition(new BABYLON.Vector3(6800,6800,6800));
                    camera.fov = 20;
                    camera.wheelPrecision = 100.0;
                    camera.maxZ = 0;

                    newScene.clearColor = new BABYLON.Color3(0.5, 0.8, 0.5);


                     engine.runRenderLoop(function() {
                        newScene.render();
                     });

                 });
             },function (progress) {
             });

           }
           window.addEventListener("resize", function () {
            engine.resize();
        });
After i put the camera.wheelPrecision = 100.0 fully latch
Link to comment
Share on other sites

doing
          var createScene = function () {
            var scene = new BABYLON.Scene(engine);
            var canvas = document.getElementById("renderCanvas");

            //Adding a light
            var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);

            //Adding an Arc Rotate Camera
            var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
            camera.attachControl(canvas, false);

            // The first parameter can be used to specify which mesh to import. Here we import all meshes
            BABYLON.SceneLoader.ImportMesh("", "js/", "teste.obj", scene, function (newMeshes) {
                // Set the target of the camera to the first imported mesh
                camera.target = newMeshes[0];
            });

            // Move the light with the camera
            scene.registerBeforeRender(function () {
                light.position = camera.position;
            });

            return scene;
        }

           window.addEventListener("resize", function () {
            engine.resize();
        });
Simply does not work
What can it be?

 
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...