Brunex92 Posted May 2, 2016 Share Posted May 2, 2016 Hey, So, is there any way of the camera zoom don't invert the canvas when I reach the (0, 0, 0)? I need to go deeper in the canvas to look at objects far away from the origin Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 Hey I assume you are using an ArcRotateCamera, correct? try using camera. allowUpsideDown = false Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 2, 2016 Author Share Posted May 2, 2016 3 minutes ago, Deltakosh said: Hey I assume you are using an ArcRotateCamera, correct? try using camera. allowUpsideDown = false Yea, I'm using ArcRotateCamera, allowUpsideDown won't work, still the same Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 can you provide a playground repro? Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 3, 2016 Author Share Posted May 3, 2016 http://www.babylonjs-playground.com/#KNMZ0#16 Basically, when I zoom in passing the center ball I want to keep going in Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 3, 2016 Share Posted May 3, 2016 Ok then just set the camera center farther than your mesh (There is no zoom per se but a radius: when you zoom you reduce the radius) I think that you should just set the lowerRadiusLimit to 1 or even 0.1 if you really want to go closer. A negative radius means that you went beyond the center of the camera Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 3, 2016 Author Share Posted May 3, 2016 I understand, but this still don't solve my problem I want to reach that sphere that is far away from the center by 'zooming in'http://www.babylonjs-playground.com/#KNMZ0#17 putting lowerRadiusLimit will only limit the radius of the camera, when I actually want to go deeper, if there is any way of doing this Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 3, 2016 Share Posted May 3, 2016 Yep by setting the camera target on the sphere:http://www.babylonjs-playground.com/#KNMZ0#18 Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 3, 2016 Author Share Posted May 3, 2016 No other way? there will be lots of spheres and cylinders what I really needed wat to pass by the center and keep going Quote Link to comment Share on other sites More sharing options...
adam Posted May 3, 2016 Share Posted May 3, 2016 I'm not sure exactly why you need to zoom past the object you are focusing on. Can you just do something like this? http://www.babylonjs-playground.com/#KNMZ0#19 Click on the spheres and zoom. Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 3, 2016 Author Share Posted May 3, 2016 That would kinda help, but some objects will be really far away, almost unclickable Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 3, 2016 Share Posted May 3, 2016 perhaps you don;t need a ArcRotateCamera? A freeCamera could do it easily Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 4, 2016 Author Share Posted May 4, 2016 But how do I zoom in with the scroll? The arcRotate was a good option because I need to rotate arond the center Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 4, 2016 Share Posted May 4, 2016 @Brunex92 what you could do, is to use arcRotate for your grid area, and when your zoom hits something like 0.1, switch to a freeCamera, (update it's position & path to same as arcRotate, pre-switching) and capture mouse scrolling, so the camera moves forward when scrolling in, and moves backwards when scrolling out and when you reach your grid area again, reset to arcRotate. Another option could be, when zoom hits 0.1, again, capture mouse scrollng, but instead of zooming, move the arcRotate's target position in the direction you're "zooming" and when you go back again, reset. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 5, 2016 Author Share Posted May 5, 2016 @aWeirdo I think that would make the visualization kinda different changing cameras that way, i was looking for something like the good old gluPerspective from the old versions of OpenGL using C++ Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 5, 2016 Share Posted May 5, 2016 @Brunex92 i'm not sure what you mean, or perhaps you misunderstood me, the idea was to have two cameras, at the grid area arcRotate is set as the active, but, you still update freeCamera's position & direction to constantly match the arcRotate, so when you switch to freeCamera nothing else really changes for the user, but you would ofc lose the rotational "benefits" which arcRotate have. but anyhow, option two, with moving the arcRotate's target position would probably be the best choice between my two ideas, unless you're up for doing a bit of customization to engine. It's quite a tricky issue^^ Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 5, 2016 Author Share Posted May 5, 2016 (edited) @aWeirdoOh I got it now, So for the first option is that I've never worked with two cameras in any 3D application, and the rotational benefits from arcRotate are really necessary for me For the second option, how can i move the target position? I don't intend to modificate the engine at all Edited May 5, 2016 by Brunex92 misspelling Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 5, 2016 Share Posted May 5, 2016 @Brunex92 arcRotateCamera rotates around a target, "camera.target" (Vector3, also camera.target.x / y or z works for specific numbers ), you would need to calculate the direction you're zooming and then calculate the next position, and update the target location acordingly. Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 5, 2016 Author Share Posted May 5, 2016 @aWeirdo So basically I have to update the target everytime I zoom in, now how do I update it? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 5, 2016 Share Posted May 5, 2016 @Brunex92 camera.setTarget = babylon vector3; should do it, but it's some complicated stuff^^ I made a simple playground to show the idea of it(the move direction is fixed), http://www.babylonjs-playground.com/#KNMZ0#21 It needs a lot of work, smoothing out movement, calculating correct movement, disabling the camera's actual zoom when it shouldn't be enabled(when zoomed all the way in and moved away from grid), etc etc.. as i said, it's a complicated issue , many variables to think about. good luck Quote Link to comment Share on other sites More sharing options...
adam Posted May 6, 2016 Share Posted May 6, 2016 @Brunex92 Is this what you had in mind? http://www.babylonjs-playground.com/#KNMZ0#22 Brunex92 1 Quote Link to comment Share on other sites More sharing options...
adam Posted May 6, 2016 Share Posted May 6, 2016 or this? http://www.babylonjs-playground.com/#KNMZ0#23 Quote Link to comment Share on other sites More sharing options...
Brunex92 Posted May 6, 2016 Author Share Posted May 6, 2016 54 minutes ago, adam said: @Brunex92 Is this what you had in mind? http://www.babylonjs-playground.com/#KNMZ0#22 @adam This one looks exactly what I needed! Thanks a lot! Quote Link to comment Share on other sites More sharing options...
adam Posted May 6, 2016 Share Posted May 6, 2016 @Deltakosh could this be added as an option to arcRotateCamera? If you look at the PG, I just added lines 29 - 39. Brunex92 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 6, 2016 Share Posted May 6, 2016 Hey...I don't really see the gain versus using lowerRadiusLimit 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.