1
$\begingroup$

This question already has an answer here:

In the Blender Game Engine (BGE), I want the player to be able to "dig through" an object. In other words, the player can shoot a cylinder at a large cube from their perspective, and in its wake, the cylinder projectile leaves a hole through the cube.

Here's the shooting of the cylinder itself using WASD-style controls and firing with a left mouse click:

shooting, but no result

and I want the result to look something like this (made outside of the game runtime using a boolean difference):

result, but no shooting

The most obvious-seeming way is to use a boolean difference-operation - in fact, that's how I generated the second image above. However, I tried using a boolean difference modifier and then running the game, and it doesn't seem to work - as you can see in the first image above. Anyway, according to this answer, a live-updating boolean operation might just not be supported in BGE.

So does anyone have any ideas for an alternative way to implement a similar functionality, given the limitation in BGE? My best guess is somehow having python detect the collision, and modifying the mesh on the fly, but I have no idea if that's even possible. I'm relatively comfortable with python though, so if you have an idea of how to approach it, please do give me a hint. Or, if there IS a way to implement boolean operations live, while the game is running, I would love to hear it.

edit: This is different from Make modifiers update in the game engine. That question's only answer is predicated on there being a pre-meshed hole/feature in the larger object (water) that follows the boat around as a child. In that method, the mesh isn't modified at all during game runtime. It's a clever work-around, but it doesn't work at all in my case. In my case, the user needs to be able to create a hole (or more than one!) in any orientation and position he/she desires.

$\endgroup$

marked as duplicate by X the fluffy 27 unicorn, p2or, David Feb 11 '16 at 21:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ You can manipulate vertices in real-time with python, however AFAIK you can't really add or remove any. So implementing a true boolean function in the GE with python isn't possible atm :/ $\endgroup$ – gandalf3 Feb 11 '16 at 20:27
  • $\begingroup$ What you request is not possible (See comment above). It is a game engine, I suggest to ask how to create the illusion of such an effect. $\endgroup$ – Monster Feb 12 '16 at 5:06