Slice a mesh using plane

#1

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?

0 Likes

#2

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

#3

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

0 Likes

#4

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?

0 Likes

#5

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

3 Likes

#6

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

0 Likes

#7

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.

2 Likes