Mobile sway script

Hi everyone! I am in search for a way to slightly way a parented object, for example, a gun which I would like to have some movement, I have tried several of the weapon sway scripts and searched everywhere for one that would work but couldn’t find any, the main problem is that, once the framerate gets slow, or I attempt to screen capture, the sway gets super choppy(I have tried all updates), even in the editor it glitches out. What is the best way going out getting a little bit of sway on a parent, perhaps based off position instead of the mouse, because I am looking for mobile use.
Anyways if anyone could point me in the right direction I would really appreciate it!

Thanks!

bump

Couldn’t you just animate it swaying on a layer of the Animator, and blend between the sway animation and any others you need?

If you have to do it in code, you could try adapting trig functions over time to make it move. They (should) always return to the point of origin at some point, so you can be sure looping it forever will work predictably. I only bring this up because I was researching a grass shader which would incorporate vertex motion to simulate wind and that was how I ended up doing it. The key is to layer different wavelengths of sin for example at different offsets to hide the fact that its just sin.