Im currently building a shooter game. In it I can pick up weapons. These will be attached throught a “Attach Actor to Component” node to a Socket in my Seketal Mesh. If a Weapon is already attached the old one will be dropped and the new one attached.
Currently every Weapon I attach to my mesh gets invisible for no reason. When I spawn them or place Weapon BPs in my Level they are visible and the “Actor hidden in Game” Option is set to false. After Attachment I need manually to change a setting like scale to get the weapon mesh visible again. Also the Weapon keeps being invisible even after dropping/Detaching the weapon. This only affects the mesh the logic for shooting still works even with an invisible weapon.
The weird thing is that this problem occured suddenly a thew hours ago all my weapons were visible befor. I tried to eliminate basic problems like restarting unreal, checking Socket names, set in “attach actor to component” every thing to Snap to Target and activated “Weld Simulated Bodies”. Maybe one of you knows whats going on here.
I tried some stuff and found out maybe its something about the physicAsset. I removed it from the SkeletalMesh of the weapon and the weapon was visible again. But without a physicAsset no forces like gravity get applied and weapons floating in thin air after dropping them.
I check the physicsAssets with a complete other item where everything works fine but I coudnt spot a difference all options are the same. I also tried creating a new PhysicAsset directly from the mesh in the context browser but unfortunately the weapons where still invisible after attaching.
So I found out where my weapon is going. It doesnt get invisible it teleports to 0/0/0 and stays there even if I move. But why do these weapons use global space if they have a physics asset attached, but if there is no physics assest the weapons use local/relative space and keep beeing attached to the socket? And the weirder thing is if I update one simple option in the weapon it teleports to the socket. But I cant replicate this with blueprints. I tried setting location or visibility through my blueprint but only if I do it manually it teleports back in my hand.
I found a workaround the skeletal mesh of the weapon needs to be root and on top of every other component. Noe the weapon is visible in my hands. But Im still curious why suddenly this occured cause in the beginning this blueprint worked just fine even without the skeletal mesh as root
This “Attach Actor To Component” node is heavily bugged although it’s very useful, same as the “Attach Component To Component” node, if choose the “Snap To Target” location rule option of this node, while attaching something to character’s any spine bone socket, and the character will do weird dancing or sky walking, 100% replicable bug and it’s funny to watch but can’t figure out the reason.
Edit: Solved this by turning the collision off for the attached object.