PathFinding service modifications, NPC car control with PathFinding service

Hello, i was working on NPC car that moves around only with hinge constraints (2 motors and 2 servos)
and i wanted to use it with PathFinding service, but i have some problems, road points are too close to each other, and too close to walls where car cant pass…

Is there any way to modify PathFinding service to make points farther from each other and walls?



for distance inbetven them i have for last solution to make script skip 1 or 2 positions but i dont realy want to do that…

Sorry for bad English…

1 Like

When you are defining the parmeters for the PathfindingService, you can tell it to say further than X studs away from other parts using AgentRadius.

For example:

local path = PathfindingService:CreatePath({AgentRadius = 3, AgentCanJump = false})

Try settings the AgentRadius value to slightly greater than half the car width. So if the car was 10 studs wide, perhaps set it to 12 to start with and see how it performs.

2 Likes

I have to ask how you mean to add this AgentRadius?
like this?
path:ComputeAsync(Car.PartS.Attachment.WorldPosition, Pos, {AgentRadius = 3, AgentCanJump = false})
or something like that?
Like this it has (with changed radius) no effect…
And may i ask, is there way to avoid sharp angles (less that 30 steps turn)

found how to fix, thanks!

(30 chars is retarted)

Please let us know how you fixed the issue. It is helpful to others who may find this article to see you solution.

1 Like

This is car now:




bit small space for 2 but its ok…
it uses 2 scripts, one for calculating angle and other for route (pathfinding service)
still sharp angles are problem but i solved problem to 50%, i only get sharp angles in front of it:

it looks like drunk person is driving it, this will stop when it makes 2-3 360 steps turn. I avoided sharp angles with skip command so if point is inbetwen 10-15 studs away it will skip it but for last point it dosent.
I just have to solve problem with:

i tried loot of stuff to fix this but none worked…

1 Like