1glayfan Posted January 30, 2018 Share Posted January 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
Arte Posted January 30, 2018 Share Posted January 30, 2018 Hi @1glayfan Just give your object a name's like "Wall", "Ground"... http://playground.babylonjs.com/#GCYMQ9 Open console and click on each object. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 30, 2018 Share Posted January 30, 2018 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". (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. Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted January 30, 2018 Share Posted January 30, 2018 I'm agree with: trouble with a capital "T" and that rhymes with "D" and that stands for "discovery". 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 ??? Quote Link to comment Share on other sites More sharing options...
1glayfan Posted January 30, 2018 Author Share Posted January 30, 2018 @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. Quote Link to comment Share on other sites More sharing options...
SvenFrankson Posted January 30, 2018 Share Posted January 30, 2018 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 ) Arte and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
1glayfan Posted January 30, 2018 Author Share Posted January 30, 2018 @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! 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.