im making a little pathfinding demo right now
it calculates the best spot from your torso to a spot on the map
could be useful for RPGs
EDIT:
im making a little pathfinding demo right now
it calculates the best spot from your torso to a spot on the map
could be useful for RPGs
EDIT:
here it is if anyone wants to visit itthe code:
player = game.Players.LocalPlayer
char = game.Workspace:WaitForChild(player.Name)
start = char.Torso
endpoint = game.Workspace.endpart
while wait() do
path = game:GetService("PathfindingService"):ComputeRawPathAsync(start.Position, endpoint.Position,512)
points = path:GetPointCoordinates()
game.Workspace.points:ClearAllChildren()
print(path.Status)
for i = 1, #points do
part = Instance.new("Part")
part.BrickColor = BrickColor.random()
part.FormFactor = Enum.FormFactor.Symmetric
part.Parent = game.Workspace.points
part.Transparency = math.random(0.1,1)
part.Size = Vector3.new(1, 1, 1)
part.Anchored = true
part.CanCollide = false
part.Position = points[i]
end
end
this also assumes you have it in a local script inside of the player's backpack/tool or w/e and you have a model in workspace called 'points'