Hersir Posted December 1, 2017 Share Posted December 1, 2017 Hi, have a question, is it possible to get coordinates in 3d space of arcRotatinCamera (width, height and leftTop corner vector) of visible area ? I need to zoom on area and than move out all not needed objects out of camera view and align mesh to topRight corner of visible area Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 1, 2017 Share Posted December 1, 2017 Hiya Hersir. This probably isn't a good answer, but look at this... https://www.babylonjs-playground.com/#ACVZF0#0 Lines 67-82. TL, BL, TR, BR... those are corner vectors, I think. Anyway, that's something to play-with. It was found via playground search for 'frustum'. Hope this helps. Stay tuned for others. Quote Link to comment Share on other sites More sharing options...
Hersir Posted December 1, 2017 Author Share Posted December 1, 2017 @Wingnut Thanks will check that, tried to go a bit different way but also stuck there const v = Vector3.Unproject( new Vector3(0 ,0 , 0), viewport.width, viewport.height, Matrix.Identity(), cam.getViewMatrix(true), cam.getProjectionMatrix(true), ); Tried to convert 2d 0,0 point to 3d in camera to get left corner but it didn't worked out well, just got centre point Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Hersir Posted December 1, 2017 Author Share Posted December 1, 2017 for now did this const leftTop = this.getScene().pick(0, 0, undefined, false, cam).pickedPoint; const leftBottom = this.getScene().pick(0, viewport.height, undefined, false, cam).pickedPoint; const rightTop = this.getScene().pick(viewport.width, 0, undefined, false, cam).pickedPoint; const rightBottom = this.getScene().pick(viewport.width, 0, undefined, false, cam).pickedPoint; Quote Link to comment Share on other sites More sharing options...
Sebavan Posted December 2, 2017 Share Posted December 2, 2017 Here is the code used internally to compute the frustum planes if that helps. https://github.com/sebavan/Babylon.js/blob/master/src/Cameras/babylon.camera.ts#L530 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.