Hide all meshes within a volume?

I’m making levels which consist basically in simple boxes as rooms, so I’m putting everything within the same level to make it easier and faster to teleport the player. For ease of editing, I want all rooms relatively close together, but I don’t want the player to see adjacent rooms.

Is there an easy way to make this? I know you can make a trigger volume and set it to make meshes visible or invisible, but that would require a lot of work, specifying individual actors. So I was wondering if there’s a better way like hiding everything inside a volume or something.

Thanks

Many ways to do this

  1. You could give the actors tags, and each BP volume only affects actors with the tags it’s concerned with

  2. You could write the volume BP to hide of show every actor it is overlapping ( just make it big enough )

  3. You could use level streaming volumes

2 Likes

Thanks. In this case it makes more sense to me to use method #2, since giving each actor a tag would require some manual work, but level streaming isn’t exactly what I want since I want all rooms in the same level map for ease of prototyping, editing, and also loading quicker in game while teleporting from one room to another.

How would you proceed though? I’m using trigger volumes to encompass entire rooms and every npc and item inside them (basically anything that’s visible within that volume), and I suppose I know how to do on begin/end overlap events from inside the level blueprint to trigger a visibility change, but I’m not sure how to search for everything that’s already overlapping a trigger volume to change their visibility, or even, on begin play, to hide everything inside all triggers except the one the player is already standing within.

Any ideas why this only shows my character and NPCs, not any parts of the room like walls, doors, interactable object blueprints, nothing?

Edit:

Pretty basic, gotta check “generate overlapping events” on everything.

So I guess I’m gonna have to manually do -something- to every actor I want to hide? be it adding tags, or checking that box, basically every single one?

You didn’t select a class :slight_smile:

image

Also, don’t try and do it from the level BP, nightmare.

Make a blueprint with a collision volume and the code in, the you can just drop it where you like.

If you do it in the level BP, you have to manage all of them individually.

I can drop some code in later, if you like… ( not at a machine rn ).

heh I did forget it, I guess. but it still works since I don’t want to filter anything out, the issue was that I had to check “generate overlapping events” on everything.

Right, I’m not a big fan of adding stuff to the level blueprint either, I was actually going to make an actor blueprint for that, but I wasn’t able to add a trigger volume into a blueprint so I decided to just do it from the level blueprint. now I modified a trigger volume into this weird shape, and I’m not sure how to convert it into a box so I can add to a blueprint, since apparently you have to use static meshes as a trigger volumes to work inside blueprints. Is there a way to convert a volume into a mesh? (edit: found it)

I think I got the gist of it from what you mentioned, no need to drop a code, at least so far. Let’s see how it goes, working on it

So this works, but only with that delay, probably since it takes more time to spawn the player character than this box.

Any better way to check if the player character is already overlapping, without a delay? This shouldn’t be an issue, but I always try to avoid delays since they can get messy with more complex code, pausing, etc.

You’re right that overlap thing is a bummer, here’s a better way

image

Begin play

and

hider

3 Likes

a better way indeed!

however for a specific level I wanted to use a custom mesh as trigger, is it possible with your method?

1 Like

Just as a note, you can have more than one box in the BP, and it will still work with the exact same code. ( or mix box, capsule, sphere etc ).

But, if you want to use a custom mesh, then you’d need to make the box a reference to a collision volume, in the world. Then you could choose your custom mesh.

2 Likes

You’re too good for this wretched world.

1 Like

:sunglasses:

1 Like

Amen, brother

1 Like

Brilliant. thanks

1 Like

So, for this specific room, I’d have to have 4 different boxes as triggers, so I can encompass all of the room and not have these triggers affecting adjacent rooms.

Would I need to set the same code (get actor, world location, get scaled box extent, etc) for each different box component, or is there a more efficient way?

Like I say, you can put 15 collision volumes in the BP if you want :slight_smile:

The code stays the same.

Once you drag the BP into the level, you can click on each volume and move them around, scale them etc.

1 Like

yeah but like, in your code you made that section specifically for one box component, not the whole bp:

so I was wondering if I’d have to make this for all the boxes inside my bp

1 Like

Why not just copy and scale like Clockwork said?

You can have more than one instance of a singular blueprint in a level.

If you want all those copies of the same blueprint to act as a unit, then group them together.

I suppose if I have different instances of the same blueprint for a weird shaped room, it will be triggered multiple times, one for each box trigger bp, instead of being triggered only once if they were all inside the same bp

Isn’t that the case? I’m not sure what you mean by grouping them together?

If it makes you feel better, you can create CHILD ACTORS in a master blueprint.

Where the child actors are all this one blueprint. That way they all have the same logic and you don’t have to copy/paste so much.


This is an example.

Just duplicate them (as child actors) and then create the shapes of the rooms you want.

I do think CLOCKWORK’s method is FAR easier.

And by “GROUP”, I mean, in the viewport of the editor, you can click multiple assets/meshes/blueprints and “connect” (don’t worry, they won’t move) in such a way that they will translate (physically move, if you move them) with each other.