d13 Posted January 2, 2018 Share Posted January 2, 2018 Hi Everyone! Is there some way to get a list of all the meshes within the field of view of the active camera? The reason I ask is I'm using CSS labels on a <div> layer above the canvas for some of my meshes and don't want to render those labels if the mesh is behind the camera I tried the code suggested in this link: I'm using it like this: var frustumPlanes = BABYLON.Frustum.GetPlanes(scene.activeCamera.getTransformMatrix()); if (!planet.isInFrustum(frustumPlanes)) { label.style.visibility = "hidden"; } else { label.style.visibility = "visible"; } (`planet` is the name of the mesh) This gives me the error message: "scene.activeCamera.getTransformMatrix is not a function" Can anyone suggest what I might be doing wrong? Thanks!! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 2, 2018 Share Posted January 2, 2018 Actually the console said everything camera does not have a getTransformMatrix function The scene did in the other hand so this code should work: var frustumPlanes = BABYLON.Frustum.GetPlanes(scene.getTransformMatrix()); if (!planet.isInFrustum(frustumPlanes)) { label.style.visibility = "hidden"; } else { label.style.visibility = "visible"; } dbawel 1 Quote Link to comment Share on other sites More sharing options...
d13 Posted January 2, 2018 Author Share Posted January 2, 2018 @Deltakosh Oh, that's awesome - I just tested it and it works perfectly! Thank you!!! GameMonetize 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.