Child actor components spawning in odd locations

So i have a series of rooms which are interchangeable based on a series of bools.

The rooms consist of static mesh components and child actors which are custom blueprint actors.

When i try to spawn one of these rooms all of my child actor components spawn at the level origin location instead of staying with the room they are child components in.

i did find that if i set the child actor components to static they will spawn in the correct locations. how ever i need the blueprint class that is this child actor to be movable.

Any ideas?

Could it be that your static mesh components inside of the child actor BP are set to “world” rather than “relative” location? you can check that by viewing the details of the components in the BP editor and right clicking on location.

the static mesh component is the root of the actor, the issue is only apparent when they are set to movable. i tried setting the actor component location to relative and world no affect.

Edit: i also tried, having the staticmesh not be the root component and set to world space, it ended up spawning at the empty actor location that i had placed in a quick test level. instead of at the weird off set.

That is odd. you are saying when they are movable, you cannot spawn them in the right location? If anything it should be the opposite depending on how you are doing it. Static objects cannot be moved at all once they are spawned so you will have to spawn it at the desired location without using and move or set location nodes.

yes, when they are set to movable they do not spawn in the location we had moved them too. IE we have a Room we set dressed the room, bottleA is supposed to be sitting on top of cabinetA but instead comes in out side of the room. the way in which i am spawning them is by using the set child actor node.

Imagine the actor i place in the world has a child actor component that i set depending on what room was applied.

I suspect that set child actor node has nothing to do with the issue however, because if i try to spawn the room in blank map using the spawn actor at location node. it yields the same result.

PS thank you for your time :slight_smile:

I dont understand how you can spawn something with “set child actor node”… that changes a pre existing child actor to be a different actor, but it does not let you spawn in a new object. That to me implies you have a child object that is already in a location and perhaps that is part of your problem?

lets break this down to the simple case. in your blank map, you are saying that ‘spawn actor at location’ always spawns the new actor at 0,0,0 regardless of where you tell it? How are you doing the spawn? Is this using levelscript on begin play or something? I will set up a repro case here in a bit.

okay so im not actually using anything to spawn the room, that was only a test case i did in order to further diagnose the problem.

Imagine that i have one actor that is placed in the world.
This actor has a child actor component:
The child component is a custom blueprint class
within the custom blueprint class there are 12 staticmeshes that make up the room (walls Floors) and more Child actor components. props with added functionality, so another custom blueprint class.

Within the prop custom class there is only 1 static mesh.

When i try to SET the child component (room) to something different using a Switch on INT, the child actor components (custom blue print prop class) spawn out side of my room.

I have same odd.
And fixed it, just the root component code is

SKeletalMeshMeshCom = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT(“SkeletonMeshCom”));
Now change it like this:
RootComponent = SKeletalMeshCom;

May it helps.