AI Movement: Troubles and Solutions
Author: Xavier Baez
Written: 10/17/25
The issues that consumed me this week were obstacle avoidance and having the AI follow a path so the player actually has competition to go against. The first issue I had to deal with was having the AI determine what was and wasn't an obstacle since if the AI couldn't make the distinction it would be scared of everything and have a really hard time trying to win the race. I had some trouble figuring out how I would even do this as I needed a way to pick and choose what is considered an obstacle that was both simple so any other object can be an obstacle and easy to implement into the sight system mentioned in my last blog post. The second issue that was much more time consuming was figuring out how to get the AI to follow the spline which is basically a line you draw out that is the path the AI follows and an example of it is in the image below as the white line going along the track. The AI would at first not even know the spline was there, then it would actually follow the spline (after lots of math), but not work with the obstacle avoidance.

Now as for the solutions they ended up being simpler than I thought and was just me overthinking. Unreal Engine has a system for tagging objects so I just had to simply tag the obstacle with a tag named "Obstacle" and I was good to go!

The "stimuliSourceComponent" is simply a component needed on objects that want to be seen by the AI perception system as without it and the proper setup in BeginPlay the AI will not see the object at all. After you have that set up I just had to check in my AI controller's perception handling if what it saw was tagged with the "Obstacle" tag, if it was sensed, and if it was get the direction of the obstacle so it can turn away from it, and once the obstacle is out of range it will go back to following the spline. The second issue was much more time consuming and took a lot more math which is getting the AI to follow the spline.

All of this code is simply telling the AI "Hey, spline is there go follow its path". The "avoidingObstacle" if check is there so that the AI can override the steering of the spline following in the case of an obstacle being in the way so it can steer away from the obstacle. Without that if check the AI will only focus on following the spline with no regard for the obstacles in its path. I also had to completely get rid of the "AutoSuccessRangeFromLastSeenLocation" variable from my sightConfig in my AI controller as that was making the AI unable to stop seeing the obstacles it passed which prevented it from hitting the code that was written to stop overriding the steering. With these three issues solved, the final result is what you see in the video below!
Get Neon Rush
Neon Rush
| Status | In development |
| Authors | FSUTeam, Pneulysta, OneToast, forevergareth |
| Genre | Racing |
More posts
- Updated Game Release!13 days ago
- Starting the save system and its UI34 days ago
- Resetting Wondering Racers34 days ago
- Finishing Up the AI and Starting the Garage!34 days ago
- Challenges When Replacing Car Models35 days ago
- Spline Directional Calculations for Race Direction40 days ago
- Making the option menu and what came from this week40 days ago
- The Problem with Unreal Engine’s Default Kill Plane40 days ago
- Ensuring Fairness in Neon Rush47 days ago
Leave a comment
Log in with itch.io to leave a comment.