Hello so i made a self driving car, With Sleitnick’s chassis, It uses 3 main system, which are wall detection and deceleration to stop colliding with walls, steering and throttle which uses the angle from the dot product to calculate how fast should it go, and finally it uses roblox pathfinding. Heres the video, Anyway, you can leave any kind of critisim on the system itself! I’d like to know what you guys think!
With regards to the Pathfinding, it looks like the car tries to hard to following the defined path which brings the car very close to the wall (@00:20), causing it to slow down.
Have you tried using raycasts to find out which waypoints are necessary for the car to follow?
For example - shooting a ray from the waypoint at this position:
to the waypoint at this position
to see if the in-between waypoints are necessary?
-- pathfinding logic above...
local carPosition = car.Position
local lastWaypoint = nil
local newWaypoints = {}
for i,wp:PathWaypoint in pairs(waypoints) do
local ray = CastRay( lastWaypoint and lastWaypoint.Position or carPosition, wp.Position ) -- start from the car's position, and go through the waypoints until the wp can't be seen - then count the previous waypoint and the current waypoints as neccessary.
if (ray == nil) then -- was able to reach the wp position without collision - not neccessary
continue
else
table.insert(newWaypoints, waypoints[i-1]) -- add the previous waypoint
lastWaypoint = waypoint[i-1]
end
end
-- continue driving the car with the updated waypoints list.
are you able to put this into the pursuit algorithm and make it chase a target?
It “Should” technically work as it uses a goal position as the goal, so it’d work but i havent implemented it to chase someone yet.
Heres the “on road” version, Which quite dissapointed me as it returned nopath for long distances
I like the self driving car. However, it appears that it errors when it’s done driving. Maybe you should fix that.
I’ve fixed that now in the latest version!