[SOLVED] Basic AI for (automated) flying dronecars

One issue I’m having is getting the AI dronecar to move in the right direction. It seems to be moving at an angle rather than along the z-axis.

And, yeah, that’s a valid point. I wasn’t thinking about making a simulation while I was CADing, and going back now would take a lot of time. Is it worth the efficiency increase? Will more devices be able to run the game? Right now, my computer handles it fine, but my laptop has some trouble.

What is the problem for you with just downscale the entity with the model component on it?

I tried that, but it lags when I launch the game.

I can’t imagine this is because you downscaled the model entity. Keep in mind that you also have to adjust the size of your collision component (and probably your forces in your script).

From your PM:

So, that worked! :slight_smile:

The only thing now is that it oscillates between distance=25 and distance=4 instead of respawning back to origin. I’m not sure if this is because something is blocking it from reaching 0, but there is nothing in the way from stopping it.

Hi @Lorenzmotors! What do you mean exactly with ‘oscillates’? My code is really basic so the problem has probably to do with the setup.

If you use a camera that is moving it’s hard to see what actual happens in the game. I advice to add an extra camera above the map and enable this camera if you need to debug something.

I mean that it gets stuck near the target, and, like glitches between distanceFromTarget=4 and distanceFromTarget=25

And, okay. I will need help with the code to add camera-switching, so I will start a new topic after we figure out this respawn thing. I’m going to be adding a 3rd-person-player, which will require camera-and-control-switching, so I will implement the above-the-map-debugging camera-view and controls at the same time.

@Albertos

So, your intuition was right. I started the process of scaling down the map. I deleted all the scenery-dronecars and launched the game. One of the two dronecars is respawning which means your code works!

Sorry for the camera angle :stuck_out_tongue: I’m going to start working on the third person controls and debugging camera after I finish programming the rest of the ai dronecars.

1 Like

Great to hear! The debug camera is simple to create. Just add another camera to your project and enable this if you need to debug. You have to disable your player (camera).

Okay, I put the debug camera in and programmed the rest of the ai, but I looked around the map, and it looks like two out of eight of the ai dronecars are functioning. One is not respawning; doing that glitch thing we talked about, and the other five are not moving.

Find out which drones are not working as expected. Check if there is a valid origin and target point for this drones. You can also try to set the distance check of 1 for reaching destination a little higher.

It was because I forgot the motion-of-the-ai function part of the code.

Thanks for your help @Albertos you’ve been a huge help. Next I’m going to implement a third person player.


Thought you guys might enjoy this little edit I made to showcase the 8-lane-z-axis demo :stuck_out_tongue:

1 Like