FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 06:45 PM |
I wrote up a little pathfinding script, where it finds the nearest humanoid, then using the pathfinding service, it computes the path to the humanoid. My problem is, it works, just if I go behind a wall or something, instead of following the path, it tries to go through the the wall, like a regular follow script. Here's the script:
function findNearestTorso(pos) local list = game.Workspace:GetChildren() local torso = nil local dist = 500 local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) then temp = temp2:findFirstChild("Torso") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end while wait(0.01) do local target = findNearestTorso(script.Parent.Torso.Position) if target ~= nil then path = game:GetService("PathfindingService"):ComputeRawPathAsync(script.Parent.Torso.Position, target.Position, 500) 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.DarkGray() part.Parent = game.Workspace.Points end for _, points in pairs(points) do print("moving to: ", points) print(path.Status) script.Parent.Humanoid:MoveTo(points) end end end
(no output, except for the 'moving to:', and the path status)
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 06:49 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 07:03 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 07:11 PM |
i guess ill try to fix it myself
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 07:13 PM |
nvm still cant figure it out
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 06 Oct 2014 07:13 PM |
bump again
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
| |
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 07 Oct 2014 06:16 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 06:48 AM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 10:45 AM |
From the Roblox Wiki: "You may notice that pathfinding can have difficulty with thin floors. Thin floors are sometimes considered empty because they don't take up much space. This is due to the way pathfinding calculates empty space in the game world. To find a path, the service divides the world into a grid of 4x4 squares called voxels. It then checks on how empty the voxels are to determine what an available path is. By default, if a voxel is less than 16% filled then it is considered empty.
To solve the issue of thinner floors, there are two solutions you can employ. Firstly, you can simply make the floors thicker (which will fill up more of the space so the voxels are considered full). The other solution is to change the EmptyCutoff to a lower value. This has the advantage of preserving the look of your level (if you need thin floors), but it does mean the paths in your level may change." Link to Pathfinding article: http://wiki.roblox.com/index.php?title=Pathfinding Link to EnptyCutoff: http://wiki.roblox.com/index.php?title=API:Class/PathfindingService/EmptyCutoff |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 05:18 PM |
The baseplate (part it's on) is 512, 20, 512. So, that's not the problem Thanks for the help, though!
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 05:59 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 06:00 PM |
been bumping this for 2 days...cmon people.
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 07:01 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 08 Oct 2014 07:57 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 09:00 PM |
| make sure there are open spaces and make sure every single wall not just base is thick |
|
|
| Report Abuse |
|
|
vacharya
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 511 |
|
| |
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 09 Oct 2014 07:05 AM |
I will do that. Thanks, master. Been bumping this for three days already.
<3 vach |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 09 Oct 2014 05:03 PM |
I made the bricks bigger, master, and it still didn't work
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 09 Oct 2014 05:07 PM |
| The thin floors deal also applies to thin walls. Make your walls thicker or tune the pathfinder thingy |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 09 Oct 2014 05:10 PM |
all the walls are over 20,20,20
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
| |
|
|
| 09 Oct 2014 08:39 PM |
| Create a path with parts through the pathfinding. |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 09 Oct 2014 08:43 PM |
i did...look at the script.
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 09 Oct 2014 09:14 PM |
bump
Never trust atoms, they make up everything.™ |
|
|
| Report Abuse |
|
|