Engine Bugs: In-Game PathfindingService fails on the client if you CFrame a model far away before you call path:ComputeAsync(pos1, pos2)

Description:
In short, the bug occurs when the pathfinding service fails in-studio and in-game if you set up a model very far away before you create any paths.

Was experiencing this firsthand in the game I was developing, but was able to pinpoint this issue directly and have therefore created a test place with the most minimal configuration to showcase the bug.

Test Place:
pathfinding_test.rbxl (24.3 KB)

Details of the test place:

  • Whenever you click on the baseplate, it will set a waypoint marker for the pathfinding service to create a path with.
  • If you click twice, you will get a fully drawn path if the pathfinding service is working correctly
  • In “InitFarModel” LocalScript in StarterPlayerScripts, I have set a simple model very far away using :SetPrimaryPartCFrame to CFrame.new(-10000, -10000, -10000) before anything else happens. The script is disabled by default.

Steps to take to reproduce bug:

  1. Open pathfinding_test.rbxl
  2. Hit “Play” in Studio. Try to set paths, you should be able to see a drawn path rendering
  3. Un-Disable “InitFarModel” LocalScript in StarterPlayerScripts
  4. Try to set paths again
  5. You will not see the path being rendered (as path:GetWaypoints() fails)

Pictures:

  1. Drawn path when it is working

  2. Path is not drawn when not working (when “InitFarModel” is turned on before you hit Play)

Weird Caveats (?)

  1. For the actual game that I’m developing, this bug seems to be really fickle wherein it does not occur in studio playtests, but only occurs in-game

  2. If you only turn on “InitFarModel” after you have already set a path (say for example you only turn it on after 10 seconds and you spam a few paths before those 10 seconds), then this bug does not occur!

  3. If you set the model slightly far away (CFrame.new(1000, 1000, 1000)), the bug will not occur. It only occurs when I start setting things over 10k coordinates away in each axis.

Specs of my PC running this:

  • CPU: Intel (R) Core™ i7 -9700K CPU @ 3.60 GHz
  • Memory: 16 GB
  • Disk: 1 TB
  • GPU: NVIDIA RTX 2080
  • Latest version of Windows 10
1 Like