Hello all, I’m working on a very sophisticated pathfinder for a game I am working for, and I notice that it makes incorrect calculations a lot and sometimes attempts to run into the wall. I have no idea what it is; my only guess could be that I am setting the agent radius incorrectly. The rigs for the game I am working on will be set with different scale values, so I am calculating my agent radius/height for each agent that way. Here is a video demonstrating my issue:
Code I am working with:
-- Code updates every second, the module is based on the Roblox documentation.
local Pathfinder = require(game.ServerScriptService["Grmln's (Using Custom)"].Pathfinder)
local Path = Pathfinder.new(workspace.Rig)
Path.Visualize = true
local Character = workspace:WaitForChild("FyreeIG")
Path:Run(Character.HumanoidRootPart.Position)
while task.wait(1) do
Path:Run(Character.HumanoidRootPart.Position)
end
Path.Reached:Connect(function()
print("Reached!")
end)
-- Calculating agent radius/height based on the HumanoidRootPart Collision Model Size and the Model Scale.
local function ScaleToHitboxHeight(Scale : number)
return math.ceil(5 * Scale)
end
local function ScaleToHitboxRadius(Scale : number)
return math.ceil(2 * Scale) -- default collision model XZ for character root is four, agent radius is that divided by two * scale
end
Please let me know if you have any suggestions/possible fixes for this issue. Thanks!