generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Pathfinding

Previous Thread :: Next Thread 
Vritix is not online. Vritix
Joined: 01 Jan 2011
Total Posts: 2790
08 Aug 2015 10:22 PM
Is it possible to use like a model of bricks for pathfinding, instead of a character, or a dummy?
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
08 Aug 2015 10:23 PM
yes
Report Abuse
Vritix is not online. Vritix
Joined: 01 Jan 2011
Total Posts: 2790
08 Aug 2015 10:26 PM
how though..
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
08 Aug 2015 10:28 PM
-- In Script in ServerScriptService

local pathfindingService = game:GetService("PathfindingService")
local pointModel = Instance.new("Model")
pointModel.Name = "Points"
pointModel.Parent = game.Workspace

-- Setup remote function
local remoteFunction = Instance.new("RemoteFunction")
remoteFunction.Parent = game.ReplicatedStorage

function visualizePath(path)
-- clear old path visualization
for _, point in pairs(pointModel:GetChildren()) do
point:Destroy()
end

-- calculate new visualization
local points = path:GetPointCoordinates()
for _, point in pairs(points) do
local part = Instance.new("Part")
part.Parent = pointModel
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1,1,1)
part.Position = point
part.Anchored = true
part.CanCollide = false
end
end

game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player, target)
local start = player.Character.Torso.Position
local path = pathfindingService:ComputeRawPathAsync(start, target, 500)

visualizePath(path)
-- Check to see if the path was computed correctly
if path.Status == Enum.PathStatus.FailStartNotEmpty or path.Status == Enum.PathStatus.FailFinishNotEmpty then
print("Compute failed")
return {}
end

return path:GetPointCoordinates()
end
Report Abuse
Vritix is not online. Vritix
Joined: 01 Jan 2011
Total Posts: 2790
08 Aug 2015 10:29 PM
I don't want to move a character.. just a model of bricks.
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
08 Aug 2015 10:30 PM
Look at the part creating..
Report Abuse
Vritix is not online. Vritix
Joined: 01 Jan 2011
Total Posts: 2790
08 Aug 2015 10:32 PM
I already have the points set :

while true do
path = game:GetService("PathfindingService"):ComputeRawPathAsync(game.Workspace.Start.Position,game.Workspace.End.Position,50)
points = path:GetPointCoordinates()

game.Workspace.Points:ClearAllChildren()

for p = 1, #points do
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Symmetric
part.CanCollide = false
part.Size = Vector3.new(1,1,1)
part.Position = points[p]
part.Anchored = true
part.BrickColor = BrickColor.Red()
part.Parent = game.Workspace.Points
end

wait(0.1)
end

I just need to make a model move from start to end.
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
08 Aug 2015 10:34 PM
m = DEFINE

while true do
path = game:GetService("PathfindingService"):ComputeRawPathAsync(game.Workspace.Start.Position,game.Workspace.End.Position,50)
points = path:GetPointCoordinates()

game.Workspace.Points:ClearAllChildren()

for p = 1, #points do
local pos = points[p]
m:MoveTo(pos)
wait()
end

wait(0.1)
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image