Overriding mass in C++

I have created a class for a heavy object that has physics enabled that the player should be able to roll in order to uncover hidden paths and to damage the player if it falls upon them. Overriding mass is pretty straightforward inside the editor, but how do I exactly override mass via code? I tried using BodyInstance and MassScale() for the static mesh component but it didn’t work. I’m new to unreal, so I’m pretty clueless, so how can I exactly override the mass via code? I also want to be able to spawn them randomly so I can’t just override the mass inside the editor. Thanks in advance.

What did you do in Blueprint for that?

I set the mesh to BluePrintReadOnly, while I just wrote c++ for the body instance