0 votes

I'm trying to create a laser beam like behavior that's wide. instersect_ray seems to be limited to using single points, so it doesn't look like a viable option.

I was thinking of creating a shape that ends just outside the screen, get hit areas with intersect_shape, sort them by distance and use the closest one.

Is there a better way of doing this?

in Engine by (85 points)

2 Answers

+1 vote
Best answer

A ray doesn't have any thickness. You're correct in aiming to use intersect_shape.

The only alternative I can think of is to use and manipulate an area node, but that is probably more work if you're wanting to adjust it a lot.

by (5,274 points)
selected by

Alright, thank you for confirming this!

+2 votes

For a wide ray you can use 2 or as many as you need between the sides.

If it is like a laser that starts growing you can have many rays and start turning them on while the laser gets wider (is for a game, it does not need to be 100% accurate, just fake stuff).

This method can give you the option to do more damage when more rays touch something and cut the ray polygon adding effects on the impact zones.

by (7,934 points)
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.