So im trying to make an AI, but the movement looks so weirdly unnatural with it just snapping at 90 degree angles around corners.
(code)
local function patrol(moveTo)
if moveTo then
local destination = moveTo
local path = pathfinding:CreatePath({AgentRadius = 4})
path:ComputeAsync(rootPart.Position,destination.Position)
local waypoints = path:GetWaypoints()
for i,v in pairs(waypoints) do
humanoid:MoveTo(v.Position)
if v.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid.MoveToFinished:Wait()
end
else
local destinations = workspace.Patrol:GetChildren()
local destination = destinations[math.random(1,#destinations)]
local path = pathfinding:CreatePath({AgentRadius = 10})
path:ComputeAsync(rootPart.Position,destination.Position)
local waypoints = path:GetWaypoints()
for i,v in pairs(waypoints) do
if patroling then
humanoid:MoveTo(v.Position)
if v.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid.MoveToFinished:Wait()
end
end
end
end
if you know any workarounds to make turning smoother for pathfinding, please tell me.
The NPC it’s doing that because you specified it on the agent parameters, increasing the AgentRadius should solve it. If not, you will need to make your own AI
Edit: if I did misunderstand your problem, reply me with a image/gif/video, please
Wait! You can use Bezier curves to make it smooth, I totally forgot it! with some magics, you could get the point that it’s near to the curve start and then you can make the bezier curve to make a smooth turn.