How do I define a region / room?

I have a building with multiple rooms. I need a way to define each of these rooms, so that I can start spawning random objects of certain types in each particular room. How do I do that?

Hi man ,
Its treacky decde what is a room, it really depend on the typer of cocnept you are working on.

Example 1,
you could create a struct variable with 8 locations, 4 to build a square and 4 more to build the upper square.
It look hard but its not.
you can use the consruct node to draw the Area you are making, drawing debug lines between them.
Now you can jjust place this actor in your level, and you should be able to spawn something in a random valor between these points.

Example 2,
I could decide that i dont need all this stuff and i dont need super precision in volumes,
So i just place some actor in some places, and then cast ray at random , if the ray hit something , hit the wall and the floor , surely inside the room i placed him.
jjust tweak the distance of the ray and the position of the caster .

Example3
Like the player start, create a simple actor with and place him in every hidespot. give this actor a variable public to set so you can set every hidespot wwith a different nummber or enum to find him,

What type of Struct do I need to use?

To me it sounds like you *already *have the rooms rather than try to construct them procedurally. How about you place a collision volume and give it a tag? Or perhaps you want to turn each room into a separate actor? Or you could use dummies / placeholders to mark places in each room where spawned things can potentially appear.

Hard to tell what you’re trying to achieve. Consider share more details regarding how it’s supposed to work.

Constructing the rooms procedurally is something being considered for the future. I was just trying to run a test on how to make items spawn randomly.

I’m rather new at all this so I don’t know what a collision volume is or how to tag it?

I thought about marking out each potential spawn location, but that would end up being far too many places. Random generation seemed the better option. All I need to be able to do is define the borders of each room, so that an item meant to spawn in a random location in Room 1 doesn’t spawn OUTSIDE of Room 1.

For example, in this image, how do I define the borders of Room B, so that I can make objects spawn at a random location within Room B, never in a different room and never outside the building.

Technically you don’t need a component or tags if you know the coordinates of the room - you can just directly work with numbers, sure. A box collision component makes it somewhat easier to manipulate and interact with the room and definitely makes it more visual. Tags allow you to filter it better later on. Perhaps this is a bedroom rather than a shed. Each room may have many tags.

Annotation 2020-06-28 083310.jpg
https://forums.unrealengine.com/core/image/gif;base64

And then:

You may want want to place a collider like this on the floor if you do not want to spawn things mid-air. Or place it high up to quickly find a random XY of the room and then trace along -Z (down) to check whether there is something on the floor already, and plop a flower pot *on *the table rather than *underneath *it.

A box component can be used to gather data about the environment:

86765303a94d5ed4dbfda1601a7419b2fa45eaf8.jpeg

So you can fetch everything in the room in one go.

How do I go about creating one of these collision boxes, and can I make them into non-standard shapes, such as Room B on the image in my previous post?

The Boxes are simply rectangular, you cant make strange shapes, but
you can add smaller boxes or rotated boxes to cover the most of them

Approximation could be *a OK-ish *for something like this. But you can make / edit brushes of (almost) any shape and convert them. What’s more, you can even convert static meshes into collision boxes; it’s an underused feature that is unnecessary hidden in an advanced panel:

Annotation 2020-06-29 090146.jpg

That’s providing you work in the Level Blueprint. Finding random even distribution for a convex volume is another story altogether, though.