Disable jump in pathfinding service

I’m trying to make an RTS game.

i use the pathfinding service allowing each squad member to move from point A to B
https://i.gyazo.com/52a884a7f851b57ac406ea30a47df0c8.gif
however, they should not be capable of jumping, but will do so anyway because the pathfindingservice thinks they can.

is there any way to disable jumping in the path calculations?

ok, and how do i identify a jump? because i would like the ai to be able to climb hills.
there isn’t a whole lot of API reference on what exactly is returned with GetWaypoints()

Two options for you…

  1. Make ridiculous bounding boxes around models so navmesh recognizes it cannot jump over it. (Would also solve the climbing problem that systack mentioned)

  2. Write your own pathfinding system. A* is pretty easy to implement and I can send you some source code of my implementation if you’d like.

yes i wrote it

it’s just as simple as


local Points = Path:GetWaypoints ()
for i,v in pairs(Points) do
    goals['Position'] = Point.Position+Vector3.new(0,2,0)
			
    twe = TS:Create(Soldier,TI,goals)-- this is declared ealier in the code, allowing me to pause if new movement orders are given
 
    twe:Play()
    wait(0.1)
end

You’ll wanna make sure that character actually reaches the target before setting a new way point target. You won’t notice on paths that are linear, but when you start going around corners, units charging into walls will quickly become a problem.

dang, i’d hoped to avoid that. like there’d be some api in the point telling you what kind of movement it is…
like, i’d hate to have to throw away the entire path just because “whoopsie! you clicked on a roof by mistake!”

aha!
after digging through some other people’s pathfinding code, i have found exactly what i’m looking for!

also, thanks for the suggestion, @VineyardVine, i’ve adjusted it to finish the tween first.

2 Likes

There’s an option to turn it off by using “AgentParameters”

local Parameters = {
	AgentRadius = 2;
	AgentHeight = 5;
	AgentCanJump = false;
	}

local Path = PathfindingService:CreatePath(TableAgents)

You’d set the AgentCanJump parameter to false then it’ll create a path that does not involve jumping.
I know this is late but this is in case you didn’t know.

8 Likes