6
$\begingroup$

I am making a racing game and I got a question. I want to make AI of simple street drivers(not opponents, but just simple pople). I want to know, how to make that AI that follows its path... Could you give me image or video tutorial?

$\endgroup$
  • $\begingroup$ You could try the Steering Actuator it has no official docs at the moment but there are some tutorials on the web. $\endgroup$ – stacker Dec 20 '14 at 22:36
  • $\begingroup$ But how do I make it follow to exact route? $\endgroup$ – Adrians Netlis Dec 20 '14 at 22:51
  • $\begingroup$ Can you still make it for me? $\endgroup$ – Adrians Netlis Dec 20 '14 at 23:15
  • $\begingroup$ Why do evryone vote down? Maybe I don't understand reason of this cause I am not perfect in English? Anyway, I just asked question- I want to make a caer that drives around my city independent of anything, but I dont know how to...:( $\endgroup$ – Adrians Netlis Dec 20 '14 at 23:28
6
$\begingroup$

You can make AI drivers follow a path very easily. First, add an always sensor. Enable Positive triggering (pulse mode). connect that to an And controller. Then add a Steering actuator. (connect that to the And controller) change the Steering actuator's Behavior from Seek to Path Following. Then add a a plane, extrude it to whatever shape you want, then change the Physics type from Static to Navigation Mesh. Add an object to be used as the end destination. Your navigation mesh must connect from your AI driver's starting point to the ending point. Select your AI driver, and put the name of your Navigation Mesh in the input field entitled navigation mesh. then put your ending destination object's name in the input field for Target Object. if you did this correctly, your AI driver will follow the navigation mesh On The Shortest Route Possible to reach the end point. It is important to note two things. First, the navigation mesh is invisible and has no collision with anything else. Secondly, Because the AI driver will follow the path on the shortest route possible, the thinner the path, the better. Notice the path the object will take in the following pictures enter image description here enter image description here From those two pictures, you can conclude that a wide path does not work as expected.

AI Driver's logic setup enter image description here

$\endgroup$
  • $\begingroup$ OK! But I need that car to never stop... I need it to drive around forever trought streets of city... $\endgroup$ – Adrians Netlis Dec 21 '14 at 10:26
  • $\begingroup$ Yes! I do it now, but i want to know, how to make it move when I crash into it... $\endgroup$ – Adrians Netlis Dec 21 '14 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.