So this “find highest point on terrain” thing i’ve been working on seems to ignore terrain where it shouldn’t.
Code:
local function GetTerrainHighestPoint(Ray)
local Parts = {}
local LastPart, Position
repeat
LastPart, Position = workspace:FindPartOnRayWithIgnoreList(Ray, Parts)
table.insert(Parts, LastPart)
print(LastPart)
wait()
until LastPart == workspace.Terrain
return Position
end
And some pictures for visualisation. First is the origin of the rays, and the second is just a part streched from the ray origin to -1000. (since it only goes down)
23:29:28.163 Caves: 100% taking a break - Server - Script:57
23:29:29.509 ▶ nil (x259) - Server - Script:69
It doesn’t suceed 9 times and then fails… the method whitch i used to “see” the rays only placed parts when the tree density was above a level so it places a tree. So it would fail instantly.
Also
local Position = GetTerrainHighestPoint(Ray.new(Vector3.new(x*4,500,z*4), Vector3.new(x*4,-500,z*4)))
This is the ray i give, but if i remove the *4 it works but the map it generates shrinks.
So why is it above terrain, and not detecting it when it’s *4? now 100% failure rate
And why does it work shrunk down when i don’t multiply?
Both cases are above terrain, with different results.