Jump to content

Check if mesh is in Frustum and not hidden by other meshes?


CorayThan
 Share

Recommended Posts

Is there a simple way to check if a mesh is in the frustum and not hidden by other meshes? It seems pretty easy to check if the camera is aimed at the mesh in general:

scene.isActiveMesh(mesh)

But I want to check if the mesh is not hidden by other meshes. I'm creating a 3-D maze and need to move/lock the camera temporarily when certain objects hidden in the maze come into view.

If I have to, I can determine a geometric area where if the free camera is in that area and the mesh is active it is visible, but I'd prefer to do it an easier / better way if possible.

Link to comment
Share on other sites

Hi and Welcome !
Yeah, there are two methods (https://doc.babylonjs.com/api/classes/babylon.camera#isinfrustum) and (https://doc.babylonjs.com/api/classes/babylon.camera#iscompletelyinfrustum) you'll find them in Mesh/Camera class,  Regarding determining the geometric area you can use this as reference - https://www.babylonjs-playground.com/#1BDA0J#0

Link to comment
Share on other sites

  • 4 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...