Jump to content

Zoom in/out with a orthographic camera


SideraX
 Share

Recommended Posts

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 :) )

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;};
Link to comment
Share on other sites

  • 2 months later...

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!

Link to comment
Share on other sites

  • 3 years later...

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