Jump to content

Problem with Mesh.MergeMeshes and CSG


iiceman
 Share

Recommended Posts

Hey guys,

 

I have a little problem and I don't know what to do to make it work. Maybe it's not possible, but that would suck since my whole idea for the monthly challenge is based on that :D So you see, it's kinda important ;)

 

First things first, the playground: http://www.babylonjs-playground.com/#4UXRQ

 

What I want to do: I have a mesh that I created by merging several other meshes with the help of mesh.MergeMeshes (the middle layer in the playground). Now I want to cut this shape out of another mesh (lowest layer in the playground). The result I get is the top layer in the playground, but it's not what I expected it to be like. I assumed I would get a clear path cut out of the lowest layer mesh.

 

I think the problem is the merging of the meshes. If I turn on the debug layer, with clickable labels and select the merged mesh I can see that it looks like there are still multiple meshes overlapping each other.

 

So what am I doing wrong? Am I using the merge wrong? Is there a better way of merging the meshes so that I can get my expected result? I tired to skip the merging and carve each single block out of my lowest layer, but that seemed to have very poor performance (my browser crashed).

 

I hope you guys can help me with that!

Link to comment
Share on other sites

@iiceman As my labyrinth is going to be totally aMAZEing and I do not want you lost and blocked in but want you to get to your goal (and I am doing it totally differently) here are some changes I made to your playground

 

http://www.babylonjs-playground.com/#4UXRQ#2

 

  1. Instead of merging the connectors I used UNION on the CSG versions of the connectors
  2. I kept the merge of meshes only to show the positive maze and moved it to the end.

You will need to check that this does what you want but I think it looks like it might.

Link to comment
Share on other sites

Pretty cool, seems to be exactly what I want, thank you! It's still a bit slow, tho. For bigger sizes it crashes my browser again. But I'll play around with it and check if I still can use it like that.

 

Looking forward to seeing your amazing maze! :D

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