Jump to content

Zoom in zoom out in 2dscene


masterdon
 Share

Recommended Posts

http://www.babylonjs-playground.com/#2WHFP1#2

Here I hooked (binded?) camera.radius to mainRectangle (called 'tang') .SCALE... in the renderLoop... line 48.  Works pretty good (mousewheel in/out).

In line 33, I needed to "return" mainRect... bring it outside the scope of the create() func.

Smarter way would be to return the canvas2d object, and then use... um... c2d.findByID... or something like that... to find the ID's of the primitives you want to "scale".  You would "look them up", using the returned canvas2d object.  Or traverse canvas2d.child[0].child[0].child[0] stuff.  That's good fun, too. :)

This demo is only scaling mainRect, right now. 

This is a slimy little solve, huh?  heh.  Heck, I'll wire camera.radius to ANYTHING... I'm just that kind of "dangerous".  :D

If you change to an "all rectangles" version of the floorplan, (like we talked about in other thread) then you will use a basic overhead camera... with zoom (cam distance to ground setting) built-in, auto-magically.

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