Have an AI track to multiple objects

I had already asked this question before, (a long time ago) but failed miserably due to my limited understanding of Blender and Python.

How can I make an object (in this case, a teammate AI) track to several different objects, without having to insert a “Track To” brick for every enemy in the game?

Thank you!

What are you trying to accomplish? Does the teammate attempt to act upon the enemy or just face them? Does he keep track of all of them and make decisions based on the enemy state? Does he just react to them in a specific order? You can’t “track to” multiple objects at the same time.

Yeah, sorry for the lack of detail…

They would turn and shoot the enemy, (I’m hoping to achieve something like the Hordes in L4D, where there are massive groups of zombies) I guess the easiest way would be ‘whoevers closest’

I’m pretty sure it’s possible, I’ll try to dig up the old thread, I recall them saying you needed Python… I could be mistaken

Example attached (hit space to switch targets).

Right now, it just selects a random target from all potential targets, but you can set it to pick based on whatever algorithm you have in mind.

Attachments

random_track.blend (568 KB)

Random is even better, and it’s such a simple script…

Thank you, Goran!
You’ll be one of many in the “Special Thanks” part of the credits :wink: