masterdon Posted May 30, 2017 Share Posted May 30, 2017 Hi Guys, I am working on 2D house planners. I have successfully rendered the design using json data structure i have. http://www.babylonjs-playground.com/#SUXKHY#4 However i am struggling with following things: 1) positioning camera in such a way that design lies exactly in between the screen. currently its on top right corner of screen. 2) zoom in zoom out should work with respect to cursor position. I.e. if i am having cursor on left side of planner, then that part should be focused(start coming to center) when zoomed in. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 30, 2017 Share Posted May 30, 2017 Hello you can ask the scene to get the world extend and then place your camera accordingly: http://doc.babylonjs.com/classes/2.5/scene#getworldextends-rarr-min-vector3-classes-2-5-vector3-max-vector3-classes-2-5-vector3- Quote Link to comment Share on other sites More sharing options...
masterdon Posted May 31, 2017 Author Share Posted May 31, 2017 @Deltakosh: Thanks a lot. I finally managed to target the camera at center of corridor(which is always going to be the middle part in layout) and position is set exactly at the same point + 200-300 px extra with respect to y axis. Marking this as solved now. Thanks a lot again GameMonetize 1 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.