- I would start creating a class for the grabbing system so we can have all its variables and functions in one place.
- When the “grab key” is pressed, check if there’s an actor with the component physics or gravity activated within a custom distance from our pawn, if so, we run a function that attaches such an object to our pawn. if there’s several objects, the one closer to the “camera” or field of view of the pawn is going to be chose.
- When the “grab key” is pressed having an object that has physics or gravity attached to our pawn, that object is going to be dropped and nothing is going to be grabbed.
- If an object with the component physics or gravity activated is in the PressurePlate, the door will open, and not close until such an object is removed from the PressurePlate.
Additionally I would add to every single check the weight of the object, just to check first that we grab objects that are “bearable” for a human or whatever our pawn is. And second, to implement weight in the PressurePlate so only objects with certain weight can activate it.