Hello.
I am currently creating a navigation system that relies on pathfinding. What this system does is gets a collection of waypoints through pathfinding service, and displays a mini “brick” where, the closer you get to them, they fade away. Its suppose to show you the direction to go, and in studio this works great as shown in the video below:
But for some odd reason, without changing any code, playing the game on roblox and doing the exact same steps warrents a massive blank zone. This blank zone changes based on where I stand, but I am so confused why this is the case
Any help is appreciated
Code:
-- Module code finds the closest road to the player and pathfinds to the end goal
function module.SetNavigation(player, endPosition)
local character = player.Character
if character and character.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
local path = PathfindingService:CreatePath({AgentCanJump = false, WaypointSpacing = 6, AgentRadius = 1, AgentHeight = 1})
local closestPos
local closestRoad
local closestDist = math.huge
for _, road in workspace.PathfindingPaths:GetChildren() do
local closestPoint = ClosestPointOnPart(road, character.HumanoidRootPart.Position)
local dist = (closestPoint - character.HumanoidRootPart.Position).Magnitude
if dist < closestDist then
closestDist = dist
closestRoad = road
closestPos = closestPoint
end
road.BrickColor = BrickColor.Gray()
end
closestRoad.BrickColor = BrickColor.Red()
path:ComputeAsync(closestPos, endPosition)
local waypoints = path:GetWaypoints()
print(closestPos)
beginNavi:FireClient(player, waypoints)
end
end
The code on the client all it does is just loops through what is returned here and creates the bricks AT THE LOCATION OF THE WAYPOINTS