How do people make AI cars?

Hi, I wanted to ask how do people make AI cars like how do they make them not drive off of roads and make them do smooth turns do they use animations or something??? I really want to know

It’s really simple. It’s just waypoints that the car follows and repeats. If the last waypoint is through a tunnel, it restarts or deletes and another car spawns.

1 Like

Alr but how do they turn smoothly and like how do they make them wait for each other for example red light they all stop and are behind each other

Probably timed stops, or detection if another car is in front of them.

1 Like

For the turning part it’s probably rig animation or many, many waypoints.

1 Like

Ohhh so they do use animations sometimes for turning?

1 Like

Sometimes. If the car detects a certain waypoint then it plays a turning animation for a second or 2.

1 Like

But how do they pathfind a part if its not a humanoid rig

It’s not pathfind. The part just moves to waypoints in ServerStorage or transparent, non-collide parts in workspace. Humanoids aren’t the only ones that can have AI. This is very similar to how Rush works in DOORS.

1 Like

don’t see any code you can use but this has instructions on what to do

Unity also has some good maths that translate into roblox. You could translate the steer direction to the steer angle on a constraint chassis.

1 Like

How would i translate C++ to lua??

Hey, thanks for linking! It’s an older topic (2021) but you could play around with the example car I mentioned:

This resource showcases steering towards a point using trigonometry, calculating and setting the properties of constraints within the assembly. You could adapt that to create steering behaviors, like chasing and path following.

Here’s an old Proof of Concept I made earlier for an ambient traffic system, which basically uses the same principles:

Read more about pathfinding with cars here

1 Like