Topic was automatically imported from the old Question2Answer platform.
Asked By
grol
Old Version
Published before Godot 3 was released.
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?
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…
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.
@Gokudomatic2 Can you provide a small tutorial how to do that?
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.
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?
grol | 2016-03-27 17:38
Make the laser sprites child of another node with the pivot at the tail and apply the rotations to that node.
hearto | 2016-03-27 18:00
@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!