I need to make a hole in a wall in real time and cannot figure out how to do it. I tried to use BSP geometry but this can’t be used in real time with blueprints. If anyone knows how to do this your help would be greatly appreciated.
Hmm, sounds indeed as a perfect match for BSP…
Maybe you could use a translucent material and set the alpha to 0 on the right place through a dynamic material or something…?
I need to be able to move my character through the hole as well
Hi VoidGoat,
Unfortunately collision is baked in when you play the game. However, there are ways to create something similar to what you are attempting to accomplish. I’m attaching two images, the first is a “hole” blueprint that is simply a box or sphere collision. You will need to create a custom object collision channel in Project Settings>Collision for this setup to work.
The second image is the player character spawning the object into place. It does a line trace from the camera to the location, searching specifically for objects with the collision type , if it finds one it creates a hole in the direction the player is facing. You can change this to a direct hole by using impact normal as opposed to hit location.
The only thing this setup doesn’t quite do yet is mask the mesh material to create a “hole”. I think location based opacity will work, however I have not tested this on my end yet. If you would like to learn more in the meantime there is a fantastic tutorial on location based opacity here:
wow thank you! I’ll try and set this up and check out the location based opacity.
what parameters should the HoleThrough collision channel have?
and do you need to make a preset?
I set the collision to initially block all so that it works as if the wall was a traditional wall. The collision setup should be set on any object you want the “hole” to affect. To do this, go to the details pane>Collision and select custom, then set the object dropdown menu to your collision object.
Woo! I finally got it working. thanks for your help
This link is a possible way to make a hole visually appear.
That is one way to do it. The problem you will have to account for is the internal portion of an asset. The opacity does create a hole, however if a player turns sideways within the asset they’ll be able to see directly out of it due to hollow interiors, etc. Additional math will be needed to “cut” a hole and create a material that shows through the object, of which I unfortunately don’t have information on at present.
Exactly, I tried some addition and subtraction in the editor to find and intersection between the negative and positive mask, but I didn’t fare well with it… But now I would use a static mesh to hide it. It’s easy for me because I’m just making holes in a floor, so the same static mesh can be used, only diff texture coordinates.
Is there a way to make multiple holes like this,? Visually I mean?
While I’m certain you can, I unfortunately do not know how one would do that. Perhaps getting a radius around the hit location and applying the opacity that way? Or potentially using a decal over the area?
Is the channel still called hole through?
Alternatively, wouldn’t it be easier to just have separate collision spheres/cubes for walls. Then, disable them and alpha out material during runtime.
Hi, when i press the button instead of creating a hole, I create a mesh …
what is the holeinwall class?