SideraX Posted January 13, 2014 Share Posted January 13, 2014 Hi I'm tying to build a 3D RPG with an isometric view (hobby project). So far i'm experimenting with the camera of the framework. There is a way of zoom in or out with a orthographic camera ? (I'm still lacking of 3D knowledge but i'm learning, BabylonJS is a great start for a newbie like me, good job ) GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 14, 2014 Share Posted January 14, 2014 Hi, You can use camera.fov for the zoom in and out. function zoomIntOut(event){ if(event.delta > 0) { camera.fov += 0.1; } else if(event.delta < 0) { camera.fov -= 0.1; }} Christopher Stock 1 Quote Link to comment Share on other sites More sharing options...
SideraX Posted January 14, 2014 Author Share Posted January 14, 2014 Hi. Changing the fov didn't change anything on my scene :/After looking at BABYLON.Camera's code, it seems to be used only for the perspective mode. Anyway I was just messing with the cameras, it was mainly for learning. At the moment I will use the perspective mode with a 30° angle. Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 14, 2014 Share Posted January 14, 2014 I'm using a zoom in/out for an orthographic camera in my current project, but badly I don't have the code right now.If you don't mind waiting several hours, I will post my code asap tomorrow morning Cheers ! Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 15, 2014 Share Posted January 15, 2014 Hi ! Here is my code. Basically, the orthographic view is recomputed for each wheel movement. /** * Zoom / dezoom in 2D view * @param {int} direction The mouse scroll (120 = one tick on scroll) */zoom2DView = function(direction) { var zoom = direction / 120; topCamera.orthoLeft += zoom *1.4; topCamera.orthoRight -= zoom *1.4; topCamera.orthoBottom += zoom *0.9; topCamera.orthoTop -= zoom *0.9;}; GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
SideraX Posted January 15, 2014 Author Share Posted January 15, 2014 Nice My intuition was telling me that this properties were the solution but I couldn't make it work ^^ Thanks ! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 2, 2014 Share Posted April 2, 2014 By the way, welcome to the forum and team, SideraX! Your question and Temechon's information will help us improve our tutorial #5 - about babylon.js cameras. Thanks! (I work on 'the playpen series' tutorials quite often. Now you do the same.) Also, keep us posted on your project. Start a thread about it... keep publishing experiments and previews, and telling us your plans and thoughts. Even post links to basic and simple scenes, zips, adventures, mistakes, discoveries, 3D art. We love it! And again, welcome. I'm Wingnut, newbie, mad scientist, toy abuser, and the biggest mouth on the forum. Glad you are with us! Quote Link to comment Share on other sites More sharing options...
gogoulor Posted September 27, 2017 Share Posted September 27, 2017 Please see my approach http://www.babylonjs-playground.com/#753B9U#1 best regards 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.