PathfindingModifiers, CollisionGroups, yet path computing fails

I’m making an npc system and ran into an issue that I’ll describe below this clip :

the clip shows that I have a model in which are a lot of parts that work as barriers for the player. Some of these can collide with the player (CanCollide = true, CollisionGroup = “Collide”), and the rest can’t collide with the player (CanCollide = false, CollisionGroup = “CantCollide”)

Group collisions :
“Collide” collides with : PlayerGroup, Default
“CantCollide” collides with : Default
“NPCsGroup” collides with : Default
“CollideNPCs” collides with : NPCsGroup

The model’s parts have a PathfindingModifier which label is set to Passthrough, and the PassThrough property is set to True.

NPCs spawn behind these parts, and should pass through them, and as you can see in Group collisions, they only collide with the Default collision group, which is pretty much the floor.

I tried limiting the path calculation by adding invisible (visible in the clip) walls with a PathfindingModifier with PassThrough = false, and an empty Label. The walls’ properties are CanCollide = true; CollisionGroup = “CollideNPCs”.

Additional settings for the pathfinding is this part of the code :

local Path = pfs:CreatePath({
		WaypointSpacing = 1.5,
		Cost = {
			Passthrough = -math.huge
		}
	})

Now as long as the barrier (model) exists, the npc path computing keep failing, thus the humanoid MoveTo() isn’t called and npcs are stuck in their place. Now if i remove the barrier, they move just fine to each node, and i have what I want. However that obviously isn’t a solution

This should cover all the information, and hopefully im in the right category :heart_eyes_cat:

Referring to this topic, it seems like a Roblox engine issue. The last solution pointed out that PathfindingModifier might have worked for him, but seeing that it might not be in your case. The best solution is probably coding a pathfinding service on your own, this is still a feature/bug that is waiting to be fixed/solved.

1 Like

Yeah it really didnt make sense considering how far I went to force a specfic (or close) path. But if its an engine bug of some sorts, there must have been a way others have done this, and your solution is a good candidate at that. Many thanks! I’ll wait a few hours/days before i set this as a solution, in the hopes of getting other suggestions around this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.