Slice a mesh using plane

Hi! Is it possible to “slice” a cube using a plane? I have a cube and a plane in my scene and when I press spacebar the plane slices the cube and the top part of cube disappears showing its height. If it is possible what methods I should use?

To be honest, I don’t have any idea how to do this with Haxe, however I imagine it would have something to do with using Booleans via Blender’s python API…

1 Like

Thanks alot for the advice! Can I make some interactive game alike using py api?

Blender’s Python api really just gives you access to the functions of Blender itself, and Blender doesn’t have a game engine in it (well, not any more). That’s what you use Armory for. While Armory is coded in Haxe and uses Haxe for it’s scripting, it uses Python to interact with to Blender.

Do any of the more coder type people here (@zicklag? @BlackGoku36?) have anything to add?

There is a mesh-destruction bundled script included in Armory, it uses quite complicated Haxe code (imo, there is maths n stuff), but it seems to work with the premise of planes, only that it uses multiple of them.Unbenannt


Regarding bundles: I’d check out point 7 of this thread:

If you want to do the splitting of the cube while the game is running, you won’t be able to use anything out of the Blender Python API. Python only has power inside of blender to setup your scene before the game runs. Once the game is build and run, only Haxe ( and JavaScript on some platforms ) can run.

Splitting the cube would require modifying the mesh at runtime using Haxe, like the PhysicsBreak example that @Simonrazer mentioned, but I haven’t done it myself and I don’t know exactly how to do it. Another example that might be useful is the mesh generation example.