How to have animations that react according to where items are

I want to know how to create animations or code that will adjust the player animations depending on where they are interacting with things and where the items are in the level.

Thank you!

Aim offset. or IK animation.
And have a look at https://www.unrealengine.com/marketplace/allright-animation-rig
it makes easy to create those anim offsets etc right in your level.