Hi everyone,
I’m trying to use pathfinding on a model made entirely of MeshParts (it’s a pig). I’ve added a HumanoidRootPart in the middle of the pig and a Humanoid because thats what i needed to make it move at all. I just have these core problems with my poathfinding i wanna get into making it do stuff but its being buggy ![]()
Issue:
- My pig did follow the path correctly, but then i broke it somehow but anyways when it did follow it, it doesn’t jump when reaching jump waypoints.
- I rotated the HumanoidRootPart 180 degrees because the pig would otherwise pathfind backwards. (so Idk if theres a fix for that)
- All MeshParts are welded to the HumanoidRootPart.
heres the simple script im using
local PathFindingService = game:GetService("PathfindingService")
local pigToMove = game.Workspace:WaitForChild("TestPig")
local humanoid = pigToMove:FindFirstChild("Humanoid")
local goal = game.Workspace:WaitForChild("GoalPart")
local path = PathFindingService:CreatePath({
AgentCanJump = true,
})
local success, errorMsg = pcall(function()
path:ComputeAsync(pigToMove.PrimaryPart.Position, goal.Position)
end)
if success then
for _, waypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
part.Parent = game.Workspace
part.Material = Enum.Material.Neon
part.Position = waypoint.Position
part.CanCollide = false
part.Anchored = true
part.Shape = Enum.PartType.Ball
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid.MoveToFinished:Wait()
end
else
warn(errorMsg)
end
My question:
Why isn’t my pig jumping at the jump waypoints?
Could flipping the HumanoidRootPart 180 degrees cause this issue?
Is there a better way to rotate the pig so it faces the right way without messing up physics or pathfinding?
image of the model
video of what its doing:
yes I do have a goal part that is is possible to get to by walking around the walls
