This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

Hey guys,

how would you do laser? At the moment i would use it in 2d but maybe 3d is coming soon. I thought maybe simple line with hdr glow? Or is there a shader to use for this? Or maybe particles?

Your ideas are very welcome!

in Engine by (97 points)
recategorized by

3 Answers

+1 vote

my first try to draw a line and then give it a glow totaly failed. Anyone knows how i can prevent the glow to behave like on the screenshot? I like to have it all around the line...

enter image description here

by (97 points)

Image is broken

0 votes

Hi

I implemented a SW laser effect in my game. It probably isn't what you're looking for but I share it nevertheless because it's a quite efficient trick.

A laser beam or laser saber in SW is in fact easy to reproduce with 2 cubes (testcube) of different color (like red ans light pink) and both superposed. And setting both material to inverted faces gives this typical shape of the laser. CPU Cost: only 2 cubes.
After that, I stopped there but you can maybe implement a blur shader to make a better effect. I've alas no knowledge in shaders.

by (703 points)

@Gokudomatic2 Can you provide a small tutorial how to do that?

+1 vote

Like this ones from my game?
https://gfycat.com/LightheartedMediocreGalapagostortoise

Laser in a nutshell

Create 3 sprites and set them to additive
Sprite A: Animated Sprite for Laser tail
Sprite B: Sprite for Body with only 1 texture on repeat mode, play with rect properties + animation player on rect to achieve the moving effect, don't forget to check the rect flag before anything on sprite
Sprite C: Animated Sprite for laser head
Collision: Use raycast

I could make a more detailed post on this devblog:
http://www.kemonogames.com
when I achieve the alpha stage from my game.

by (80 points)
edited by

Man this one is great. I had ideas in this direction but wasnt shure how to really do it. How do you manage the rotation of the start and end point sprites?

Make the laser sprites child of another node with the pivot at the tail and apply the rotations to that node.

@hearto
nice idea!
So, may I look at code of the raycast or maybe you could make a demo of this.
I would be very grateful for this!

@hearto
um... no, it didn't :D
I don't understand how to make raycast collision

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.