I made a static mesh blueprint actor (paper) that can be grabbed by a grabber and placed inside another static mesh blueprint actor (chamber) when you hold it in your hand and click on the chamber.
The picking up and inserting works without issue. The problem arises when I run the code to detach the paper from the chamber and try to call Grab Component at Location with Rotation from the Physics Handle component.
For whatever reason, after I detach the actor and call Grab Component, it runs both of those nodes. But when I try to print out the grabbed component directly after, the physics handle doesn’t actually have the grabbed component inside. Does it fail silently?
The input to Grab Component at Location with Rotation is of type “Primitive Component Object Reference”, whereas my component to grab is of type “Static Mesh Component Object Reference”.
This is what my paper blueprint looks like (the one I’m detaching and trying to grab)
The Target of Detach is the Physics Handle on my player character that comes from a BPI_Interaction interface. The Paper Slot is the Static Mesh Component of the paper that needs to be taken out. The print at the end of the exec runs no problem, so I know Detach and Grab get called. It’s just that once I go through my process of placing the paper inside the chamber and pulling it out, it goes to 0,0,0 in the level instead of the Physics Handle.
It still doesn’t move though even after I grab it, so I figured: What if the previous attachment disables “Simulate Physics” or “Movable”?
Turns out that Simulate Physics needs to be deactivated. (I ejected with F8 while playing and then searched for the paper object in the outliner)
The problem is the following: I explicitly add a Set Simulate Physics which is set to True after the the Detach and Set Location, but when I eject again to see if it actually set Simulate Physics to True, it doesn’t do it. The paper just hangs in mid air in front of me.
I tell him to simulate Physics but it doesn’t do it. Does it apply the Simulate Physics to the wrong component in the Actor hierarchy? What is going on here?
EDIT:
I checked every component in the outliner and all of them have Simulate Physics set to False.
Does it do it for one tick but then it switches back? Can I not use the paper slot reference to set simulate physics after Detachment? Does Grab Component at Location with Rotation change the Simulate Physics boolean somehow?
Hmm it looks like you are attaching the Paper to PaperSlot component in the chamber, but then you are detaching PaperSlot instead of detaching Paper. So it works once but then it’s in a messed up state because your chamber no longer has the PaperSlot.
In the chamber BP you should keep a reference to the attached Paper, and detach that instead of detaching PaperSlot. Or use PaperSlot->GetAttachChildren to get the paper.
I don’t even know if a component slot and the actor inside it can be really differentiated in Unreal. All I want is to place a Blueprint Actor on another Blueprint Actor at a predetermined location and the detach it again. That cannot be that difficult, right?