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: AI Pathfinding (Utilizing EmptyCutoff)

Previous Thread :: Next Thread 
kaddad14 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
06 Mar 2016 06:52 PM
Your path variable isn't the service.
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
06 Mar 2016 06:53 PM
That is not what you had before.
Report Abuse
kaddad14 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
06 Mar 2016 07:21 PM
Sometimes the simplest solutions are the best solutions.
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