How to make a DOOM - esque UI swaying when moving your character?

How do I recreate the swaying effect present in DOOM when moving the camera? I’ve been trying to attempt this for a game of my own, DOOM inspired, with how the UI bobs up and down when moving… Is there any math required to do this?

I’ve seen @PoptartNoahh 's RooM ★ game have this feature as of now, and I’ve been scratching my head on how to do it myself for a few weeks now. Here’s a video of what I mean . You can see the gun at the bottom center swaying around as the character moves. Any ideas on how to achieve this? Thanks a ton!

There’s been a lot of posts here about camera bobbing or swaying. Try the Search tool up top.
There are other posts about showing a player’s arms or weapons too. Change up your search terms to cover all items you may encounter posts about. Things like 'player camera bobbing" or “show arms and gun” or “fps camera sway” etc.

I’ve been searching through the DevForum for a really good while now and there I can’t seem to find any solved posts about swaying UI this specific way, sorry.