I just loved it!!! I’m working in a city-style game where NPCs should walk around the city and use crosswalks, It’s really amazing.
This is also very useful if you are creating buildings in blender. You can block off navmesh errors which are caused by thin walls. Just solved the issue of mobs trying to pathfind through building walls by using kill brick example to block off thin walls and crosswalk exaple to set an easy path in and out of building. I also set pathfinding weights for other materials so mobs prefer to walk on crosswalks.
When I try to recreate the door example, I get a warning saying that the passthrough property isn’t supported?
My code:
local pathService = game:GetService("PathfindingService")
local endGoal = workspace.Goal
local doorVolume = workspace.DoorVolume
local modifier = Instance.new("PathfindingModifier")
modifier.ModifierId = "Door"
modifier.Name = "PathfindingModifier"
modifier.Parent = doorVolume
doorVolume.PathfindingModifier.ModifierId = "Door"
doorVolume.PathfindingModifier.PassThrough = true
function createPath(goal)
local canCrossDoor = true
local agentParameters = {
Costs = {
Door = canCrossDoor and 1.0 or math.huge
}
}
local path = pathService:CreatePath(agentParameters)
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, goal.Position)
local waypoints = path:GetWaypoints()
for i, point in pairs(waypoints) do
script.Parent.Humanoid:MoveTo(point.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
end
wait(2)
createPath(endGoal)
Very cool feature btw! Glad that roblox is taking steps forward to improve the pathfinding system for us!
EDIT:
Found out it was because I didn’t restart studio lol
Can you guys on ROBLOX support your pathfinding system to climb truss parts as well?
it would be nice if NPCs would be able to climb trusses and ladders while pathfinding when it is supported by roblox and not by 3rd party algorithms. It is good for zombie and shooting games.
its probably because you have enabled all beta features. I had the same problem and to fix it i had to turn off all beta features and turn on only the PathfindingModifiers feature.
Anything in the works for adding links between locations, for example if it was set up using 2 attachments/parts with a Cost paramter and a oneway option.
Path:ComputeAsync()
could then return that link as a waypoint which then allows the developer to carry out custom actions, for example Teleport or Climb.
When do you guys plan on releasing this from beta? I couldn’t find anything in the thread that lets us approximately know for when we can start implementing and releasing this into our games
You can use any numbers.
Personally, though, I wouldn’t use numbers that are too big or less than 1.
Sure. As soon as the bridge becomes walkable (lowered), the Pathfinding Modifier will apply to it.
You are dealing with disconnected parts of navmesh here. Currently, we can’t pathfind past the areas of cost math.huge. What I would try is to make gaps under the glowing red things, so that jump links can be generated.
What are the materials that you are using and what costs did you assign to them?
If you mean “to set a JumpHeight”, I think we have it already:
Oh I see what you mean. Yes, this is current limitation of our navigation system.
Not exactly. I’m referring the the CreatePath method on the Pathfinding Service PathfindingService | Roblox Creator Documentation. In the agentParameters we can specify “AgentCanJump” but we can’t specify how high that agent can jump. Since the Path object doesn’t have any knowledge of any sort of Humanoid object we can’t use the JumpHeight field of a Humanoid, and I really don’t want that as it would be far less useful than being able to tell the pathfinder how high the agent can jump.
Thank
Add jump code:
if waypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
Its working. got through.
See if this helps: Character Pathfinding | Roblox Creator Documentation
Feel free to post your level along with instructions to reproduce the problem.
A property of what? Part? It could work if you have a list of Parts to work with and set their properties individually.
Now imagine you have a forest of 1000 trees and you want to change their navigation area all at once. The easiest way to do it, in my opinion, is to enclose them all in a volume (we currently use non-collidable Parts for it) and attach a Pathfinding Modifier to that volume.
Yep. The default cost value of 1 or greater than 1 will deliver the shortest path to you. Now what does a negative cost even mean? The longest path? Just don’t use it.
Please do.
You are welcome. Enjoy!
We are thinking about supporting models.
For now, if I understand correctly, you can just include the Pathfinding Modifier into your model and just replicate it as many times as you like.
Also, I would only use costs that are equal to or greater than 1, at least for now. At the very least, use positive values. Negative values basically mean “give me the longest path”, and what’s the longest path.
If you’d be able to patch this, that would be huge for my upcoming game. Seems to work great if you allow the rig to jump, though. But I can’t have that behavior occur.
So to start, here’s what the nav mesh looks like on a simple staircase that I can obviously walk up controlling my own character without jumping:
repro.rbxl (290.8 KB)
And there’s the repro. In the rig there’s a simple script I whipped up. Obviously it works with CanJump enabled but fails to do so without it on, as seen in the above picture.
Thanks
I deal with this issue all the time too. My fix for it is to use a part in a collision group that collides with nothing to force the shape of the nav mesh. It’s pretty amazing what you can do using this technique. For stairs I typically do a slanted part. But it would be awesome to get the nav mesh to handle these types of situations a bit better.
I think the ask is whether or not this will be something we can configure in the future. My game doesn’t use humanoids or standardized humanoid-like physics. I use a different jump height/power and a different gravity, so it’s impossible to utilise NPC jumping
Thank you!, for some reason I’ve never seen that devhub post before. I still have much to learn when it comes to scripting but I’ll play around with this just to practice some.
Edit: is it possible to do a path finding that essentially is a ai walking around, stopping etc to stand then walk around again. Then when the player “comes into their vision” or say shoots at them they react and go to the nearest cover object kinda at random? Or would you need to set up the path finding paths and then code up a system that if shot at they use those paths. Or if player is in vision they react in such a way and move around fighting back.
Basically do you got to set things up or can you just script it without the set path. And just have it find it it’s self
You can use pathfinding to reach a point, such as next walking destination or cover. But you need to provide this point to the pathfinding. Depending on what you want, you could choose between a few designer-placed Part locations, or maybe you could even generate a location randomly.
Hi Cinderstock! Could the engineers at roblox support the roblox pathfinding system to climb truss parts and ladders?