Why Static Mesh Component can't be reattached to it's Root Scene Component

Hey guys, this is my blueprint hierarchy:

image

And my event graph is:

So basically I have pickable class that I attach actors to my character’s hand socket. I use “Item” component to display my main “Pickables”. In this case I use sword mesh.

But I wanted to use this way:

image

As logically I have 1 static mesh to display, so root component doesn’t need to be mesh component.

BUT…

I found that using Simulate Physics node deattahces first mesh in the hierarchy from its root. So using “Scene Component” as root, deattaches mesh from root and trying to reattach it only works this way:

In this case I attach “Item Component” to “Scene Component” after I use "Simulate “Physics” node then attach it to hand after reset relative location. But now the problem shows itself again, even tough scene component has mesh as it’s child, it hold its static transform and doesn’t move in world. For visualy understand it I used a pointlight:


When I picked it:

When I dropped it:

As you can see pointlight that child of scene component holds its last world location because of the reason I mentioned before.

So when we use root component as placeholder mesh component, because of this rule: deattahces first mesh in the hierarchy from its root it deattaches from our ThirdPersonCharacter therefore it maintains it root world location and it’s child component. So I kept using the nodes in the first screenshot.

If you have some ways to overcome the attach issue please share.

Have fun and keep developing :vulcan_salute:

Typically we use two separate actors for this type of stuff. The item dropped/picked up is a low data place holder. Whereas the attached actor is typically heavy data functional actor class.

Say for example a gun. The attached actor is going to have a lot of logic (firing, reloading, aim down sight etc). There will also be a lot of variables, usually heavy structs.

We don’t drop these into the game world. We drop a simple static mesh actor with a few vars and gameplay tags.

On pickup you either destroy the simple or return it to an obj pool. Then spawn/pool the heavy data actor.

1 Like

Thank you for heads up mate, but won’t it create a problem like continuity? For example if my weapon has blood stains on it after i hit someone, and if i drop it, won’t it be cleaned immediately?

Why would it break continuity? You can pass the material info over to the place holder.

Overall it really depends on the size of your game. Servers load everything to memory. Clients load what they need.

1 Like

Thanks again, it clicked something in my head :+1: