#how do i make these collisions not happen
1 messages · Page 1 of 1 (latest)
ty
how does getparts in part work and how is it used for what im trying to do
hmm, your case would have to work a bit different
you'd want to generate a part/the hitbox of the building you're GOING to build, and then check if any buildings already exist inside it (using GetPartsInPart)
im using findfirst ancestors but it says it expects a string but got a table
oh nvm
got it
i need the name of the part im using
it isnt working right now
i dont know why
any errors, or what is it doing rn?
show your new code?
distancing is the white box around the house
ive never used getparts in part and im not familiar with find first ancestor
dw, shouldnt be hard to fix
FindFirstAncestor is just as it says, it goes upwards through the parents until it finds one with a matching name
having a look now
ahhh okay
so, it depends on your setup
all the buildings are in a folder
if it goes through the parents and not the children
then it wont find the other models its touching
either the building name with FindFirstAncestor, or just do if part.Parent:FindFirstChild("Distancing")
latter seems cleaner
latter.?
the 2nd option of what i just said
** You are now Level 3! **
any solutions to that?
i think ive had it once
before but i dont know anything about it
the part is inside the model
im confused
because when you do part.parent
its essentially just searching its self
ahhhh true, my bad
youll need to exclude it
you can do that with OverlapParams
can you paste your code here
instead of screenshotting
ill edit if you like, should work
ok
wait
how do i copy and paste it like how you did in the other thread
lemme show a example
why ping me
do that
anyway dw
local Map = workspace:WaitForChild("Map")
local Buildings = Map:WaitForChild("Buildings")
local function randomizeposition(Building)
local X = math.random(-400,400)
local Z = math.random(-400,400)
local RandomOrientation = math.random(1,360)
Building:SetPrimaryPartCFrame(CFrame.new(X,1, Z) * CFrame.Angles(0, math.rad(RandomOrientation), 0)) -- move 20 studs in the y-axis from the origin and rotate 45 degrees in the y-axis
local params = OverlapParams.new()
params.FilterType = Enum.FilterType.Blacklist
params.FilterDescendantInstances = {Building.Distancing}
local parts = workspace:GetPartsInPart(Building.Distancing,params)
local CollisionFound = false
for _, part in parts do
if part.Parent:FindFirstChild("Distancing") then
print("found collision")
CollisionFound = true
break
end
end
if CollisionFound then
randomizeposition(Building)
print("Building Had Collision With Other Building.Relocating Building")
end
end
for i,Model in pairs(Buildings:GetChildren()) do
randomizeposition(Model)
end
added 'params' and adjusted the 'local parts = ' segment
there
oh k
basically just added a blacklist to it
but, im not sure if thats the main problem if you were getting a script timeout
unless there's just not any space for the new building, which would cause that!
just increase the x and z
the capacity of it is 400
yee
but the distancing is 100
i added 10 testing houses
for the scripting
ill do that now
uhh
still got script timeout
i dont know how
found collision (x1622)
ok
it keeps timing out a taround 1600 to 1700 collisions
then doesnt work
OH
MY BAD
ive got it now
what was it lol
i didnt copy and paste the script u did
i didnt see it
i was afk for a few minutes
nvm that was a lie
i responded 1 minute after
im just slow
isnt blacklist deprecated
yeah they are
they were deprecated
** You are now Level 4! **
until recently they were deleted
they were replaced with exclude/include
im gonna try that instead
fixed it