Intersect ray having a specific width

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Daniel Mircea
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: avencherus

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.

Alright, thank you for confirming this!

Daniel Mircea | 2017-02-03 22:09

:bust_in_silhouette: Reply From: eons

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.