0 votes

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.

vehicle
script

in Engine by (83 points)
edited by

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

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).

Thanks exuin

1 Answer

0 votes

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.

by (83 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 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 webmaster@godotengine.org with your username.