RayCast2D stop working selecting multiple player units

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ArthurER

Hi , I am having difficulty with RayCast2d that I added to vehicle units to help them drive around obstacles. for one unit it works great , I don’t meant that only one unit works right , I can instance a few jeeps and a few tanks and if I select any one of them they are able to avoid running into things ,but if I select more than one , the RayCast’s seem stop working , so if I select say three vehicles and point them into an obstacle they no longer respond and drive around it.

but… if I drive a few units to a place they get stuck , and select one while it is stuck without giving a second click to set destination the RayCast starts working again and it navigates the obstacle while the others stay stuck until I click on them.

I am wondering if it may be something about

units = space.intersect_shape(query)

that wakes them back up, but am not really sure or what I can do about it.


script

still don’t know how to post images here right but “vehicles” and “box select script” do link to images on right click.

ArthurER | 2020-09-30 21:09

Like this:
vehicles
https://i.ibb.co/H2h6YRV/script.jpg
box select script
https://i.ibb.co/H2h6YRV/script.jpg

You weren’t linking the image properly. You were linking pages with the images on them, but not the images themselves (url didn’t end in .jpg).

exuin | 2020-09-30 22:40

Thanks exuin

ArthurER | 2020-09-30 23:07

:bust_in_silhouette: Reply From: ArthurER

I found a solution to this issue , I went back to square one, started a new project with a test jeep , used a tutorial by KidsCanCode for a top down car drive game adapting that to move to click and went from move and slide to move and collide to use the collision return value to turn the jeep away after collision calling ‘get angle to’ to set a temp target destination into a target array. I tried quite a few things now to avoid using hard collision but I could find no way to make that work for groups of jeeps / tanks.