Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mbalint | |
Old Version | Published before Godot 3 was released. |
I know the basic Physics2DDirectSpaceState.intersect_ray()
and RayCast2D
class, but those stop at the first object they hit. Is there any built-in way to get all object intersecting a ray?
Thanks!
Then you don’t want to cast a ray but maybe to use a (area with) segment shape and checking overlap.
eons | 2017-01-28 19:49
Thank you! I found out that there is a shape type called RayShape2D
. I added this to an Area2D
checked the overlapping objects, then got the contact points with collide_and_get_contacts
. It works ok.
mbalint | 2017-01-28 20:50
No, actually, I used SegmentShape2D instead of the RayShape2D.
mbalint | 2017-01-28 20:55