- Home /
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!
Answer by phxvyper · Apr 01, 2016 at 12:03 AM
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:
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.
Yes that beam is basically what i'm after. Thanks for the reply, I'll look into bezier curves. I'd also be into an animation that just follows the straight line, but I still have a lot to learn about the line renderer.
No problem. I'm glad i could help. Don't forget to upvote and bestanswer my answer if you think it qualifies as the answer to your question! :D
Also, as for creating that sort of animation, I'd figure that'd be a shader you could apply that creates that effect. $$anonymous$$y roommate made something similar with a shader, without having to animate anything in a 3d modeler or animator.