Hello everyone,
I would like to follow this circuit to a car, I looked a lot but nothing convinced me and my attempts were only failures. I really don’t know how to go about it. Does someone have an idea ? Thank you
Hello everyone,
I would like to follow this circuit to a car, I looked a lot but nothing convinced me and my attempts were only failures. I really don’t know how to go about it. Does someone have an idea ? Thank you
I’m going to assume that you use pathfinding?
Oh wait never mind, that’s for humanoids. I suppose if you put a humanoid inside of the car, you could do it. Hm. I’m not very experienced, sorry!
Here’s the pathfinding Developer Hub article- Character Pathfinding | Roblox Creator Documentation
I don’t have any scripts for you, unfortunately. I hope this article does help a bit, though.
Try to make waypoints with anchored parts, then put them into script, like here
local waypoints = {game.Workspace.Waypoint1, game.Workspace.Waypoint2, game.Workspace.Waypoint3, ...}
local car = game.Workspace.Car
local tweenservice = game:GetService("TweenService")
while true do
for i, v in ipairs(waypoints) do
tweenservice:Create(car.PrimaryPart, TweenInfo.new(0.1), CFrame = v.CFrame)
wait(0.1)
end
end
Or you can make model and put waypoints there, then do like here
--change waypoints to game.Workspace.Model:GetChildren()
local waypoints = game.Workspace.Model:GetChildren()
Thank you for the answer ! I had started like this but the car did not turn at the angles and the wheels attached by welds constraints remained in place
Thank you ! But does that mean that I should make waypoints at regular intervals and in a curve at the angles? and how to keep the car facing
What vehicle constraints do you have? Are you able to set the wheel AngularVelocity and steering programmatically?
(If you’re using Roblox’ endorsed vehicles, the answer is yes. If you’re unsure, feel free to PM me your vehicle model & chassis)
I still have some static path following code (no pathfinding needed) from my pursuit AI projects.
Hello, i made my own car with blender, so there are just 3 mesh back wheels, front wheels and the meshcar, no constraints
Ah okay, for the most realistic form of autonomous driving, constraints should be used (or some other way to set steering & velocity programmatically) so you can calculate the steering angle to the next position.
I’m not really a car chassis programmer, so I can’t help on programming the constraints, if you choose to do that way. Once you achieved to use constraints, let me know and I can help you further