sailor Posted February 27, 2017 Share Posted February 27, 2017 Hello, I'm new in BabylonJs and I try to modelize an house with an hole as door. I create my house Mesh with the ExtrudeShape shape function and now my problem is to create the door. I substract a box with the CSG function but it does not do a complete hole, only the shape of the box. I did a playground with my current progression. http://www.babylonjs-playground.com/#1MR5CY Is my project is possible ? Quote Link to comment Share on other sites More sharing options...
wo997 Posted February 27, 2017 Share Posted February 27, 2017 @sailor Just create another mesh, make a flat box and it will look well Quote Link to comment Share on other sites More sharing options...
sailor Posted February 27, 2017 Author Share Posted February 27, 2017 I want to be able to see the inside of the house through the door. So your suggestion doesn't answer my request. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 27, 2017 Share Posted February 27, 2017 I did it on my terrain editor. You can see the code here: https://github.com/dad72/TerrainEditor/blob/master/js/terrainControl.js But this will create a hole in a mesh Babylon. Otherwise you can do it with your 3D software Quote Link to comment Share on other sites More sharing options...
gryff Posted February 27, 2017 Share Posted February 27, 2017 @sailor: Welcome to the forum My guess is that you do not have an inside to the house. See attached image A. So when you use CSG it just cuts a depression when applied to just one edge of the mesh. Image B has an inside an an outside to the mesh and the cutting mesh goes through both - you see an inside and an outside. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Hans Posted February 27, 2017 Share Posted February 27, 2017 I tried this too. There is a problem if you want to use physics. You have to generate your own physicsImposter if the player sould collide against the walls. If you use one physicsImposter for the result CSG, then the player cant enter the house because the physicsImposter (Box, Circle, any) will go throught the whole house. To prevent this you have to generate more physicsImposters. Than you can create the walls one by one too. Quote Link to comment Share on other sites More sharing options...
sailor Posted February 28, 2017 Author Share Posted February 28, 2017 @gryff Thank you for your advise. That solved my problem ! http://www.babylonjs-playground.com/#1MR5CY#2 Quote Link to comment Share on other sites More sharing options...
gryff Posted February 28, 2017 Share Posted February 28, 2017 @sailor : glad to be of help You might want to try converting to a flat shaded mesh. See this PG I added line 38. cheers, gryff Quote Link to comment Share on other sites More sharing options...
sailor Posted March 1, 2017 Author Share Posted March 1, 2017 Thanks for this new advice. What does it do really ? Quote Link to comment Share on other sites More sharing options...
gryff Posted March 2, 2017 Share Posted March 2, 2017 22 hours ago, sailor said: What does it do really ? @sailor : gives you nice sharp angles between the floor and walls etc. If you don't need that - no need to do it Just comment out the line I added to see the difference. cheers, gryff Quote Link to comment Share on other sites More sharing options...
sailor Posted March 2, 2017 Author Share Posted March 2, 2017 I noticed that vertices number increased when this function is called but I hadn't notice any visual difference. With your explanation I saw It. Thanks ! 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.