Hello, I am trying to make code for “digging” in a game I am working on. I have spent quite a long time trying to get it to work with limited success. The way I am trying to achieve this is by creating an inverted sphere, destroying the triangles on this sphere outside of the main mesh, clearing a hole in the main mesh, then connecting the semi-sphere back to the main mesh. You can see the way it looks when all but that last step is complete in the image linked below:
I have attempted methods of patching in that gap, but I have not yet found one which works correctly. One such attempt can be seen at the image linked below:
If anybody knows an effective method of fixing this issue, that would be great. Thanks!
Maybe take a look at this: GitHub - karl-/pb_CSG: A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/).
Which is a port of: http://evanw.github.io/csg.js/
…it looks like the image “a.subtract(b)” at the second link appears to be your solution.
I appreciate it, and that would certainly work under normal circumstances, but I’m not sure that it would be able to work in my game simply due to the way that I’ve structured the data for the world and its mesh. I’ll try to look through the source code and find if I can apply the method they used to my game.
1 Like
I tried to implement it into the game and it had some errors and also just took an excruciatingly long time to execute. The code I currently have can run in about 0.1 seconds, whereas this code took around 30 seconds on a very small planet. I appreciate the effort but I don’t think it will work. I am more just looking for a method which will work to connect the two meshes.