mind0n Posted November 17, 2018 Share Posted November 17, 2018 Refer to the playground url below, if we press Up arrow to move the camera ahead and we'll see that the GUI.Multiline is still visible. Is there any way to hide the GUI.Multiline when all the connected meshes are behind the camera? https://www.babylonjs-playground.com/#XCPP9Y#723 Quote Link to comment Share on other sites More sharing options...
Nodragem Posted November 18, 2018 Share Posted November 18, 2018 I don't have much time to sort out all the solution, but here is a possible path of action. 1) use: let nearPlane = BABYLON.Frustum.GetNearPlaneToRef(camera.getTransformMatrix()); That gives you the equation of the plane that decides if a mesh is still visible when the camera is getting too close. The property nearPlane.normal gives you the a, b, c while nearPlane.d gives you the d of the following plane equation: ax + by + cz + d = 0 2) Substitute the x, y, z with the coordinates of one of your meshes. 3) The sign of the result will tells you if the mesh is behind or in front of the plane (I mean: on one side or the other of the plane; you will have to find out which one is front/behind). Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 19, 2018 Share Posted November 19, 2018 Pinging @trevordev Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 19, 2018 Share Posted November 19, 2018 You could try this PG: https://www.babylonjs-playground.com/#XCPP9Y#730 which hides the line when a mesh is behind the camera 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.