0
\$\begingroup\$

I've set up a simple code that allows the player to use a line trace to pick up objects and assign them to one of three sockets on the character mesh.

Blueprint graph 1

I then set up the ability for the player to cycle between items in 'pockets' and items in hand, as well as dropping the items.

Blueprint graph 2

Everything works fine. The player can pick items up and drop them, as well as cycle them between hand and pocket, as long as 'Simulate Physics' is set to false on the item that is being picked up. Anything the player interacts with that has 'Simulate Physics' enabled falls through the floor upon interaction. this is the physics settings of the object:

Settings

I need the code to allow me to pick up physics items. I believe that the 'Set Actor Enable Collision' is the issue as when this is not in the loop the Actor does not fall through the ground, however I need to disable the Actors collision with the player otherwise movement is hindered. I don't understand why the 'Attach Actor To Component' doesn't hold the Actor in place when the Actor 'Simulate Physics' is set to true. I've tried adding a 'Set Simulate Physics' before and after the 'Attach Actor To Component'. This does stop the Actor from falling through the ground, but the Actor does not connect to the socket as it does when the physics is turned off in the Panel. I have tried setting the 'Set Simulate Physics' function before and after the 'Attach Actor To Component', as well as after 'Set Actor Enable Collision'. They do stop the gun from falling but the script still fails to set the Actor to the slot.

\$\endgroup\$
2
  • \$\begingroup\$ Presumably you considered turning off physics simulation on pickup and restoring it on drop, the same way you do with enabling collisions? \$\endgroup\$
    – DMGregory
    Commented Nov 8, 2022 at 12:34
  • \$\begingroup\$ Want to update your question to show this, and we can delete these comments? \$\endgroup\$
    – DMGregory
    Commented Nov 8, 2022 at 13:48

0

You must log in to answer this question.