Jump to content

How to determine if a mesh is wall or plane


1glayfan
 Share

Recommended Posts

Hello all, I have a basic question:

I want to determine if a given mesh has the structure of a plane/ground, or wall, or neither one. This will be used basically for spatial understanding of a scene.

Are there already functions in babylonjs that can do this ? Thank you.

Link to comment
Share on other sites

Yeah!  But sometimes... ya got "resource discovery" to deal-with.  Some other user in your online game world... imports a house into your world, and its got crappy names.  In the dark... if you shine your pickingRay flashlight at a wall of the house... it reports... "building01".  Oh no!  Wall?  Window?  Door?  What?  :)

Then, ya got trouble... big big trouble my friend... trouble with a capital "T" and that rhymes with "D" and that stands for "discovery".  :D

(I think Wingnut bought some good quality pot, this time.)  heh.  

mesh.metadata = "wall".  Or... allWalls.push(mesh).  Or... mesh.metadata = { type: "wall" }... or... mesh.getBoundingInfo().boundingbox.extendSide...  nahhh. 

Maybe the best solution is to cook-up a pound of cheap bacon, and sit around in your underwear all day, hacking BJS scenes and watching Real Genius, Top Secret, and all 5 Scary Movie movies.  :)   A 'zany' festival!  Maybe slide-in a little Leslie Nielsen stuff, too.  FUN!  Wrongfully Accused is just wonderful!  Zany-ness overdose, 4sure!

(Just kidding, of course.  My comedy writers are on vacation, so I'm "winging" it)  Party on.

Link to comment
Share on other sites

I'm agree with: trouble with a capital "T" and that rhymes with "D" and that stands for "discovery". :lol:

No one knows where he will use it. :) 

In my project I'm using metadata, like you mention it.

If scene "fixed" more than enough name's like "Wall", "Ground"... Depend on ??? ;)

Link to comment
Share on other sites

@Arte @Wingnut thanks for the replies!

Well the purpose is to analyze the spatial info of any gltf or 3d model written by others not necessarily to yourself. Thus decorating the mesh with specific name or Metadata won't work here. I suppose you can do this type of analysis by checking the mesh geometry or pos/rot or some other math properties. I remember one of the sample codes for hololens is doing just like this. Except here you want to do it for a virtual model. 

Link to comment
Share on other sites

Hi,

Here's an example using some very advanced programming...

http://playground.babylonjs.com/#Y1AVCL

On click, watch for the hit normal, to tell between Walls, Floor or "Other objects" (see line 42)

For this kind of cases, it could also be possible to compute some "normal medium" accross the mesh. 

Like the medium of all the mesh vertices normals, weighted by the area of the associated triangle. If you wan't to differentiate floors and wall, I guess it can do the trick even when walls are made with stretched cubes...

(my guess is Hololens does some sick computation to tell between walls and ground, far beyond the kind of trick I'm talking about :) )

Link to comment
Share on other sites

@SvenFrankson hey, this is pretty nifty codes you wrote! thanks!

I will look into deeper later today.

Regarding the hololens, well the hololens hardware has the ability to build the mapping info of your surrounding. It's still up to your app to add the wall/floor semantics. The hololens academy virtual class has codes that do this. I will try to dig this, I believe it's not that rocket science. But first, I'll examine your sample codes. Thanks again!

Link to comment
Share on other sites

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...