0 votes

I want to implement a wavy laser beam similar to the Proton Backpack in Enter the Gungeon.


It's easy enough to draw a line from one point to another, but how to get the undulating curviness and the lighting effects?

How could one achieve a similar effect in Godot?

in Engine by (1,597 points)

I will add this as a comment rather than an answer since I don't know wether it would work or not.

What I would try is to calculate an array of points from beginning to end, and smooth a variation range with something like gaussian noise (that would get you soft curved paths), then just keep adding the next gaussian coordinate and deleting the first ones so it can flow.

I can't add more since I don't even know how to use the gaussian algorithm, but I saw something like this for Processing (although Processing actually have a next_gaussian() method that does the trick effortlessly).

You can make a series of lines which lead to a target, and then, using a Curve2D, smooth it out. The trouble with this method is you have to smooth out the curve at runtime. So you need to set the control points in the Curve2D such that they change with the position of the player, and the player's intended target.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.