Dad72 Posted January 5, 2016 Share Posted January 5, 2016 Hello, How to keep the camera or to a position sufficiently away so that an object is completely visible by its scale.Some very large object that makes the camera is found on the inside of the object and I would like to reposition the camera so that the object is seen entirely. How to do ? This is for a mesh explorer (a mesh viewer) Thanks for your help. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 5, 2016 Share Posted January 5, 2016 The only easy way I think is with an ortho camera, where distance from camera has no meaning unless really close to 0 / negative, or way too far away. Not sure this will work for you though. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 5, 2016 Author Share Posted January 5, 2016 Thank you JC. I like to keep the rotating camera for rotation around the object. The ortho camera is fixed. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 6, 2016 Share Posted January 6, 2016 Ortho is not fixed position / direction. It is not even really a camera. It is a mode.cam.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA;I tried a playground with an ArcRotateCamera & ortho turned on. The camera was set way back. I do not know why, but it did rotate. Maybe if you can find how to ortho is working here you might make it work. Playground, ortho commented out Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 6, 2016 Author Share Posted January 6, 2016 I'm going to try. Thank you JC Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 6, 2016 Author Share Posted January 6, 2016 It does not work. whatever the size of the object, the camera still has the same radius.If I put the sphere has a size of 20, the camera is in the interior of the sphere.Also the prospect seems strange compared to the normal mode of the camera. http://babylonjs-playground.com/#1UMSDF#1 Quote Link to comment Share on other sites More sharing options...
Convergence Posted January 6, 2016 Share Posted January 6, 2016 http://www.babylonjs-playground.com/#1IFIES#0 Little crude, to make it a bit more sleek you could do something with camera.fov and trigonometry Dad72 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 6, 2016 Share Posted January 6, 2016 Convergence's solution is good. I would do exactly the same. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 6, 2016 Author Share Posted January 6, 2016 Convergence thank you, this is a good solution. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 6, 2016 Author Share Posted January 6, 2016 I improve the stage in the event of a change of scale. And boundingSphere.radiusWorld and seems to work bettervar size = sphere.getBoundingInfo().boundingSphere.radiusWorld;camera.radius = size * 3.6;camera.setTarget(new BABYLON.Vector3(0, size / 2, 0));http://www.babylonjs-playground.com/#1IFIES#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.