mout99 Posted June 23, 2017 Share Posted June 23, 2017 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(); }); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 Hello and welcome! you can use camera.wheelPrecision mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 23, 2017 Author Share Posted June 23, 2017 Thanks but did not solve, I put several different values and even then it has not changed at all. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 It works here: https://www.babylonjs-playground.com/#10D6YT#1 see how fast you can zoom with mouse wheel mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 23, 2017 Author Share Posted June 23, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 can you please repro it in the PG? mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 23, 2017 Author Share Posted June 23, 2017 In PG you are giving me the error You must at least create the camera, how do I solve it? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 create a camera You need to create a function named "createScene" which returns a scene with a camera: https://www.babylonjs-playground.com/#CQ0JWQ and then add your code in it mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 23, 2017 Author Share Posted June 23, 2017 In that link the code is running without a createScene () and is working,https://www.babylonjs-playground.com/#10D6YT#1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 right.. it is a hack I should not have used this one mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 23, 2017 Author Share Posted June 23, 2017 Can you show me the right way to do it? , I need to use a file with .obj extension, Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2017 Share Posted June 23, 2017 sure: https://www.babylonjs-playground.com/#J8USRK mout99 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 26, 2017 Author Share Posted June 26, 2017 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? Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 26, 2017 Author Share Posted June 26, 2017 When I call the createScene() function, it gives me the error: engine is not define @edit Okay, somehow I made it work, except the zoom is still not working, see: https://playground.babylonjs.com/#SDH7IS Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 26, 2017 Share Posted June 26, 2017 Hi M99. https://playground.babylonjs.com/#SDH7IS#1 I show good mouseWheel zoom activity in BOTH of our playgrounds. Yours was slow, mine is faster. No mouseWheel zoom for you? GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
mout99 Posted June 26, 2017 Author Share Posted June 26, 2017 Ok, I managed to solve the problem, thank you very much for the attention of those who helped, the problem was solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.