Download

How to edit a blocking volume in blueprint?

Hey all I have levels that are randomly generated, I don’t know what size they will be before they generate, I need a blocking volume so the player can only leave at the designated exits, it’s all setup good and well.

Except, I can’t get a reference to the blocking volume within a blueprint. I can get a variable that is a blocking volume but I can’t seem to edit it’s collisions when I spawn one in?

I need to edit the one I created’s bounds and location on level creation but If I can’t get a reference I can’t. Basically just scaling it up by the levels size and setting it’s location to the levels origin.

I can create a new one by spawning it in when needed but I can’t make it hollow or set it’s collision responses.

So, how do I reference a blocking volume that is already created and in level through a blueprint? or How do I edit a new blocking volume’s collision responses and make it hollow?

Edit: I realize you can’t even edit any settings of a blocking volume in bp, what the hell? Are dynamic blocking volumes just not possible? My game is completely random gen so it’s literally impossible for me to set this up before play.

Thanks.

Did you try leaving Scale alone (1,1,1 etc) and instead using the Set Extent node?

It doesn’t exist? Pulling off a blocking volume variable and there are no settings I can edit in the bp.

True, doesn’t work… My bad!

Someone else will have to explain why it doesn’t work, but it appears the normal object hierarchy is different for BlockingVolumes / Trigger Boxes in Levels, versus the equivalent in Blueprints. It doesn’t come up often, as working in the Level Blueprint is less desirable (as code has to be copied manually to all levels).

Anyway, you could just add a Box Collision to a new Blueprint (Set the collision) and then drag or spawn that dynamically in the level. Then use the Set Extent node… To access all your blocking blueprints use Get all Actors of Class (Blocking Blueprint) or Get All Actors With Tag and set a default Tag unique string.

okay is there a way to make the box hollow though? Or would I have to do one for every level edge cause that makes this massively more difficult.

By ‘hollow’, you mean no collision at all, or partial collision??? Either way, same advice as before…
Create a Blueprint with Box collision… Drop the BP into the level… Then you have total control etc…

No blocking volumes have the option of being hollow cubes and you can directly control it’s extent. That way you can just encase your level within a hollow cube you can’t leave instead of potentially needing 6 cubes.

No single blocking volume maybe, but you can layer Collision volumes inside each other using the Priority property. While disabling the inner collision the outer collision remains. Try it and see… If not, there are other things to look at including continuing to use 2 collision overlapping boxes. The inner just has overlap presets not blocking. But once the EndOverlap event of the inner box is triggered, it activates collision on the outer box etc, blocking the player and creating a hollowed out collision effect.

What else… Create a hollowed out static mesh with collision that can be resized. The mesh is set to hidden in game or visibility false. So the collision remains but the mesh is invisible.

What else… A virtial blocking volume… Since you already know what the extent of the box should be (somehow?), there are nodes to check if the player location is contained within that box, and if not deny / reverse the player move etc… But what if you’re really just guessing the extents right now. Then there is a Actor Array Bounds node that will return a box around all the level actors, which gets you to the same point…

What else… BSP is an alternative form of level design. Maybe you can you use BSP at runtime to create a dynamic hollowed out bounding box. IDK, but its maybe worth looking into… That’s all I got dude… Good luck!

No single blocking volume maybe, but you can layer Collision volumes inside each other using the Priority property. Disabling the inner collision at a higher priority should override the outer collision that still remains, but is inactive, so long as the player remains inside the bounds of the inner box. Try it and see…

If not, there are other things to look at including continuing to use 2 overlapping collision boxes. Set the inner box to use overlap collision, not blocking. Once the EndOverlap event of the inner box is triggered, however, have it activate collision on the outer box etc, blocking the player and creating a hollowed out collision effect.

What else… Create a hollowed out static mesh with collision that can be resized. The mesh is set to hidden-in-game or visibility false. So the collision remains but the mesh is invisible. This is the most common way to do what you want. Its a lot easier to debug at game time too, as you can unhide the mesh and see where the actual bounds are, far easier than working with the lines of volumes visually. Its my preferred option, but the collision primitives involved are higher.

What else… A virtual blocking volume… Since you already appear to know where the extents of the box should be, there are nodes to check if the player location is contained within that box, and if not deny / reverse the player move etc… But what if you’re really just guessing at the extents right now? Then there is a Actor Array Bounds node that will return bounds sufficient to create a bounding box around all the level actors, which gets you to the same point…

What else… BSP is an older alternative form of level design. Maybe you can you use BSP at runtime to create a dynamic hollowed out bounding box. IDK, but its worth looking into maybe… That’s all I got dude… Good luck!

Alright, I know the rough size of the levels before gen so I could just do a hollow cube I guess, thanks.