ok i am very much getting desperate with this thing
-
What do you want to achieve?
A: im trying to get my cars to follow a “racing line” made of parts around a racing track. -
What is the issue?
A: although the script works fine and all, i think the problem is on the car itself.
basically after some time that the car has been following the line, it starts waving around from side to side in the line trying to correct its trajectory so it stays within the line, but this causes it to wave around too much due to speed to the point where it wrecks. (no idea if i made sense, english isnt my primary language)
-
What solutions have you tried so far?
A: i tried initially changing the setup of the car so it was tighter, but that didnt really work and it kept waving around after some time
heres a snippet of code from the ai script:
if closestPoint then
local difference = closestPoint.CFrame:PointToObjectSpace(LineFollower.CFrame.Position)
local steer = difference.X
if steer ~= nil then
seat.Throttle = 1
if difference.X > 1 then
seat.Steer = -1
elseif difference.X < -1 then
seat.Steer = 1
else
seat.Steer = 0
end
else
seat.Throttle = 0
seat.Steer = 0
end
end
(“closestpoint” is the closest part to the car, which is found on a pairs inside the same loop of this script)
edit: ok i had no idea streamable links needed to be downloaded my bad