local O=require(game.ServerScriptService.Server.RRT)local m=3 local N=workspace.Start local P=workspace.End local g=1000 local A=600 local s=1000 local E={}function registerObstacle(O)local N=(O.Position.X-O.Size.X/2)*m local P=(O.Position.Y-O.Size.Y/2)*m local g=(O.Position.Z-O.Size.Z/2)*m table.insert(E,#E+1,{N;P,g,O.Size.X*m;O.Size.Y*m;O.Size.Z*m})end for O,m in pairs(workspace.Collisions:GetChildren())do registerObstacle(m)end print(E)local S=O.new({N.Position.X*m;N.Position.Y*m;N.Position.Z*m},{P.Position.X*m,P.Position.Y*m;P.Position.Z*m},E,{g;A,s},15,15,100)local j=O._Start(S)
--Perpelea Vlad Developed the ellipsoid heuristics
local RRT = require(game.ServerScriptService.Server.RRT)
local real = 3


local start = workspace.Start
local endpoint = workspace.End

local XDIM = 1000
local YDIM = 600
local ZDIM = 1000

local obstacleList = {
}


function registerObstacle(part)
	local x = (part.Position.X - (part.Size.X/2))*real
	local y = (part.Position.Y - (part.Size.Y/2))*real	
	local z = (part.Position.Z - (part.Size.Z/2))*real

	table.insert(obstacleList,(#obstacleList)+1,{x,y,z,part.Size.X*real,part.Size.Y*real,part.Size.Z*real})
end

for _,v in pairs(workspace.Collisions:GetChildren()) do
	registerObstacle(v)
end
--[[
for _,element in pairs(obstacleList) do
    local prt = Instance.new("Part",workspace)
	prt.Anchored = true
	prt.Position = Vector3.new(element[1]+(element[4]/2),element[2]+(element[5]/2),element[3]+(element[6]/2))/real
	prt.Size = Vector3.new(element[4],element[5],element[6])/real
	prt.Color = Color3.fromRGB(0,0,0)
end]]

print(obstacleList)



local rrt = RRT.new({start.Position.X*real, start.Position.Y*real,start.Position.Z*real},{endpoint.Position.X*real, endpoint.Position.Y*real,endpoint.Position.Z*real},obstacleList, {XDIM,YDIM,ZDIM}, 15,15,100)
local nodelist = RRT._Start(rrt)
