masterdon Posted May 7, 2017 Share Posted May 7, 2017 I am having trouble enabling zoom in zoom out feature in 2d scene. what am i doing wrong here: http://www.babylonjs-playground.com/#2WHFP1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 7, 2017 Share Posted May 7, 2017 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". 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. 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.