jiggly beam like tf2 medi gun?

Hi, I’ve written a script that connects two rigidbody game objects to each other with a line renderer so that they have a “beam” connecting them even as their positions change. It works great, but I’d like to get more life out of the beam, kinda like the beam from the medi gun in team fortress 2: it’s a bit rubbery and elastic, and almost follows your movement, but moves back into a straight line if there is no movement. I’ve looked into line Renderer advanced techniques, but I can’t really find anything this specific. Anyone have ideas about how to do this?

Thanks!
67073-steamworkshop-webupload-previewfile-121997321-prev.jpg

I would suggest creating a sort of Bezier curve. Have the originating point and the target point, and two points in the middle that control the Bezier bend in the middle.


You’d have to do some research on the equations for bezier curves and also find a way to give life to them. I would suggest rotating them around the center point randomly but smoothly:

Have these points rotate around, say, the middle position between the originating point and the target point, just smoothly randomize their position, and connect all the points.


You could also go the Overwatch route and make the beam have a genuine bezier curve:

67074-mercy-damage-boost.jpg

Which is the same concept, except with only two points and two bezier points associated with the two points. Do some research on bezier curves and you might find the result you’re looking for.