Curious idea but no idea how the do it in JME

I want to be able to split an object into two or more different objects by dividing on a specified plane. I can easily figure the math out, but I wanted to know if JME has some way to do this built in. Other suggestions and ideas on how to achieve that ability. Thanks for any help.

No, jME3 has nothing like that, jME2 had a class for that though, as it did not do the clipping for the water on the GPU.

Well, is there a way that I can modify and split the meshes with my own added code?


Sure, but I gotta warn you, it’s not going to be easy.

In order to split a mesh in two pieces, you’re going to want to determine where the plane intersects the mesh. Then you’re going to want to make an edge-ring of vertices where the plane intersects the mesh and likely copy it. From this point, you’re going to want to determine what is now part of mesh1 and what is part of mesh2. Then it becomes a matter of reconstructing the polygons on both mesh1 and mesh2 along those edge-rings you created earlier. Then I suppose you’ll want some way to texture the new polygon in the middle if you’re trying to cleave people or something.

All-in-all, this is the cliff notes of how to do it. To actually do it, is a giant Godzilla of a pain in the ass. However, if you’re just cleaving boxes in two, it shouldn’t be terrible. You’re going to be messing around in the vertex buffers a lot. There’s a tutorial on custom meshes; that would probably be a good place to start.


Actually, it the boxes were just an example. The intention is for complex meshes. I just need to figure out the cleaving on a specified section of a plane and checking for that. Identifying vertices as members of different meshes I have covered. Thank you for heading me in the right direction. I don’t suppose remaking the armature involved is also possible?

Actually back to the edge-ring thought, if I had split an object with a figure eight like cross section there would be a mess of clipping. I found another solution and it will documented though.

For obtaining a mesh’s triangle data, I know there are the “getTriangle()” methods but they do not give all the data. How do I get the Vertices, Texture Coords, and Triangle data as represented in the custom meshes tutorial?

@normen whats the name of the jme2 class ?