I am overhauling my item pickup logic since I am tired of using the UPhysicsHandle and all the nonsense that comes with it. I want to simplify the whole ordeal by just attaching items to be picked up to a socket called “Item Holder” on the static mesh of my player character.
So the idea is:
- Line trace on Action Input Grab
- If bool IsHolding is false and bool of Line trace is true, execute attachment.
- Actor in level is attached to socket “Item Holder” on player character.
- Attachment Rules: Location: Snap to Target, Rotation: Keep Relative, Scale: Keep World,
Weld Simulated Bodies: True.
So here is the problem: Different items have different rotations at which they make sense while they are being held (they are just floating in front of the camera).
I do not know how to change the Rotation: Keep Relative in such a way that I can provide a fixed Rotation when they are picked up.
I have a function that determines the class of the actor and in that function I specify what pick up rotation the actor is supposed to have. But how do I pass this pick up rotation to the Attach Actor to Component node? This worked previously with the UPhysicsHandle approach, where I set the rotation to a fixed value in Event Tick while an item was being held. But how do I do it here, since the Type is EAttachmentRule Enum?