kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 06:18 PM |
| Well I got this AI script that calculates a path from one torso to another somewhere else in the workspace. Everything works fine and well but as soon as it gets to a block that is too small it won't calculate through that block. It just pretends the block isn't there. So I looked at the wiki and the API and I got to use EmptyCutoff (which is a property of the gameservice PathfindingService). So all I got to do is somehow change the EmptyCutoff from its default .16 to something tiny like .01 or .0. How do I do that? If you need the script just ask. (Although I don't think it's needed) |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 06 Mar 2016 06:37 PM |
pathfindingservice.EmptyCutoff = .40
I think that's it, Idk I don't have a good enough laptop to test it. |
|
|
| Report Abuse |
|
|
kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 06:40 PM |
Well I tried this-- path = game:GetService("PathfindingService"):ComputeSmoothPathAsync(script.Parent.Torso.Position,workspace.Player1.Torso.Position,200) path.EmptyCutoff = .40 points = path:GetPointCoordinates() and it just said that EmptyCutoff isnt a valid member of path |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 06 Mar 2016 06:46 PM |
local pathService = game:GetService("PathfindingService") pathService.EmptyCutoff = 0.1 -- default 0.16 |
|
|
| Report Abuse |
|
|
kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 06:51 PM |
| That is basicly what I had before but renaming the variable and making it local. Or are you implying that I make a new script and do that? |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 06 Mar 2016 06:52 PM |
| Your path variable isn't the service. |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 06 Mar 2016 06:53 PM |
| That is not what you had before. |
|
|
| Report Abuse |
|
|
kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 06:56 PM |
| So I should set the path's EmptyCutoff value then give it the two points I want it to calculate and the max distance between them? |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 06 Mar 2016 06:59 PM |
Just replace it with this:
game:GetService("PathfindingService").EmptyCutoff = .40 |
|
|
| Report Abuse |
|
|
kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 06:59 PM |
Ok, so I did this--
local path = game:GetService("PathfindingService") path.EmptyCutoff = 0.1 -- default 0.16 path:ComputeSmoothPathAsync(script.Parent.Torso.Position,workspace.Player1.Torso.Position,200) points = path:GetPointCoordinates()
and now its telling me that path.GetPointCoordinates isn't a valid member of Pathfinding service |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 06 Mar 2016 07:01 PM |
points = path:ComputeSmoothPathAsync(script.Parent.Torso.Position,workspace.Player1.Torso.Position,200):GetPointCoordinates()
|
|
|
| Report Abuse |
|
|
kaddad14
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 649 |
|
|
| 06 Mar 2016 07:19 PM |
| Well thanks guys, the script worked and I realized that if I change the EmptyCutoff it makes the path glitch out and not calculate well. So I will just insert a script to make the NPV jump if he touches a wall or just have him jump at random times. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2016 07:21 PM |
| Sometimes the simplest solutions are the best solutions. |
|
|
| Report Abuse |
|
|