Need to find out what "room" a spawned actor starts out in.

I have static meshes that are tagged at design time with certain functionality and then at run-time they are replaced with a Blueprint actor that copies the static mesh inside itself and destroys the original mesh in the world. This is all fine and good and works like it should.

In the level, I have room definitions that cover each room in the building, and spawn points where these meshes can randomly move to based on the conditions in the game. The room definitions have a collision box that covers the extents of the physical rooms.

Here’s the problem: I’m at a point where I need to limit which one of these can move based on whatever room they’re originally spawned in. So, for instance, I want to pick an actor to move, but only pick one that was located in, say, a certain office.

When these items are spawned, I want to store whatever room definition they’re in in the BP. That way when I go to randomly move one of these actors, I can verify that it’s in an “active” room before it gets chosen to move.

I have tried every form of checking for overlaps between these item actors and the room definitions with no success. I’ve made sure everything is set to generate overlapping events, I’ve made sure the collision is set to overlapping on absolutely everything. It seems like nothing I do will get one of these actors to know what room they’re in. I had the same problem with the spawn points, but since those blue prints are placed specifically by hand and not spawned in at run-time, I just hard-set the room definition that they’re in manually in the editor. (Time consuming, but it works.) Unfortunately, I can’t do that with the moveable objects themselves since they’re spawned at run-time.

I’ve tried having the “moveable object” detect the room it’s in. I’ve tried having the room detect what moveable objects are in that room. This should be so easy with a call to any of the “overlapping” BP nodes but none of them will acknowledge that these two actors are overlapping.

I’ve tried putting delays in just in case the objects are spawning before the room definitions are, and vice versa. Nothing. The collision settings all have the overlapping checked on both the moveable object BP, and also the room definition BP. I’ve made sure even the option to generate overlap events for the level streaming objects are set. Still nothing. (Don’t remember the exact wording on this one, sorry.)

I, unfortunately, do not have any screenshots of code as I’ve deleted all of the overlapping checks because I have tried checking from so many blueprints that it just got confusing to look at anymore. I’ve even tried checking for the overlaps between the two objects from a third bp (the main game “engine” bp, so to speak) and even that won’t acknowledge that the moveable item is inside one of the rooms.

I just need to know that one object is located inside another object!! This should be simple. What is going on here? Hopefully this isn’t too long and confusing. I’m very tired and exhausted from trying to get this working for the past three days.

If I do a print string on all of the actors that generate an “OnBeginOverlap”, I can see all the moveable objects listed when they initially spawn in (amongst may other objects), but when I modify that to pick out just that bp type, suddenly there’s nothing. It doesn’t acknowledge that any of these are of the BP class that they are. (And yes, they are.)

Anything is helpful at this point. I’m not above sacrificing chickens or summoning demons if it’ll get this working. I just need to be able to pick an object that is located inside one out of many rooms.

1 Like

Overlapping does sound like the way.

If the room has a large volume, and the BP has a smaller volume, then this works

RoomBP is the larger one.

That didn’t work, even though it should have, and I even added a collision/trigger sphere component and tried a delay before calling the overlap check.

But I tried adding an OnComponentBeginOverlap event to the sphere collision. This does seem to get triggered immediately when it spawns in, and I could see the room definition in the list of actors when I did the print coming out of the Other Actor pin.

So I filtered that result to capture the BP_RoomDefinition and set it, then did a print on the set variable (just to make sure it was actually being set) and that seems to be the only way that it works.

But I’m marking yours as a solution, because I know that that should work, and was my initial way of trying to get it. I don’t know why it gave me so many problems. Even with a delay, it wouldn’t let me know that it overlapped anything. I invariably came back with a 0 length array.

But here’s the BP of what I did: (The Do Once is just to make sure that it doesn’t keep changing the starting room as it moves around as I only need to grab this information when it spawns in.)

Thanks! Now I can filter the available objects/rooms based on the difficulty setting that the user chooses.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.