Tableuraz Posted August 14, 2015 Share Posted August 14, 2015 Hi there ! I have a small question, I am looking for the best way to make a mesh match the camera clipping plane.The only issue I am getting is that the camera is always zooming/unzooming because the mesh never perfectly fits the clipping plane... I made a simple Playground scene to show the issue :http://www.babylonjs-playground.com/#AZZNI You can increase the zoomingSteps value if you can't see the issue. Thanks in advance for your help, I will keep you informed if I find a solution. Quote Link to comment Share on other sites More sharing options...
Tableuraz Posted August 14, 2015 Author Share Posted August 14, 2015 Issue fixed, in case anyone has the same issue, here is the corrected playground, you can change the "ground" size before running it again to see it work :http://www.babylonjs-playground.com/#AZZNI#1 And you can modify the code to this if you don't want to have a function running in the background for no reason :if (!ground.isCompletelyInFrustum(scene.activeCamera)) { scene.beforeRender = function() { if (!ground.isCompletelyInFrustum(scene.activeCamera)){ scene.activeCamera.fov += zoomingSteps; scene.activeCamera.setTarget(ground.position); } else scene.beforeRender = null; }}else if (ground.isCompletelyInFrustum(scene.activeCamera)) { scene.beforeRender = function() { if (ground.isCompletelyInFrustum(scene.activeCamera)){ scene.activeCamera.fov -= zoomingSteps; scene.activeCamera.setTarget(ground.position); } else scene.beforeRender = null; }} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 17, 2015 Share Posted August 17, 2015 Well done! 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.