Unanchoring CanCollidable Parts Causes Parts to Explode

My Goal:
Here is my basis
image
Now you can remove some supporting blocks
image
And I want the blocks to rise upwards because the falling of the hexagon makes it go away from the center of the screen. So I have a block below them (can’t see it) and it has both a BodyGyro to stabilize the orientation and a BodyPosition to make the upward movement nice and smooth. (The hexagon simply has a body gyro to prevent falling forward or twisting)

The Problem:
You see, when I unanchor all the supporting blocks so the block below can push up, the entire structure explodes
image
I don’t want this obviously

My Attempted Solutions:
So here is what I have done:

  1. Made the hexagon unanchor parts in a 5 stud radius
  2. Made the hexagon unanchor parts in a 10 stud radius

To put it simple (1) was boring, and (2) made the structure explode, YAY!
I am really at a loss for why this happens, they should be really close yes, but they shouldn’t be overlapping.
I could separate the blocks by like 0.01 studs so this doesn’t happen but that seems counter-intuitive to me…

(The spawning process happens by cloning a model where all the parts are anchored and collidable then the block below moves under that part and the entire structure is meant to unanchor so that it may move upward)

Relevant Code:

local hm = script.Parent
local hex = hm:WaitForChild("Hexagon")
local occ = hm:WaitForChild("Occupier")
local creat = hm:WaitForChild("Creator")
local pCon = hm:WaitForChild("PartContainer")
local coms = game.ReplicatedStorage.RemoteEvents.Homes
local coms2 = game.ReplicatedStorage.RemoteEvents.Game
local stab = hex.Stabilizer
local layers = game.ServerStorage.FillModels:GetChildren()
local playing = false
local creatLim = 21.75 - creat.Size.Y*2
local stabData = {["D"] = 100000,["P"] = 10000000,}
local creatBPData = {["D"] = 1000, ["P"]= 10000,}
local oP = hex.Position --original points
local oPCreat = creat.Position

local function cleanPCon()
	for _, mod in ipairs(pCon:GetChildren()) do
		if mod:IsA("Model") then --lets not waste any processing power on anything else
			for _, part in ipairs(mod:GetChildren()) do
				if part.Name == "Support" then
					part.CanCollide = true
					part.Anchored = false
					part.Parent = pCon
				else
					part:Destroy()
				end
			end
			mod:Destroy()
		end
	end
end

local function fill()
	zeroCreatBP()
	math.randomseed(tick())
	while creat.Position.Y > creatLim do
		local c = layers[math.random(1,#layers)]:Clone()--layers[math.random(1, #layers)]:Clone()
		c.Parent = pCon
		c:SetPrimaryPartCFrame(creat.CFrame)
		--c:MoveTo(creat.Position)
		wait()
		creat.Position = c.MovePart.Position
	end
	creat.CanCollide = true
	setCreatBP()
	creat.Positioner.Position = creat.Position
	--creat.Orientation = Vector3.new(0,0,0)
	creat.Anchored = false
	cleanPCon()
end

local function control() --main loop
	while wait() do
		if occ.Value then --just a fail safe
			if playing and not hex.Anchored then --if the hex is unanchored
				if hex.Position.Y < creatLim then --detect loss
					playing = false
					hexTotalReset()
					for _, c in ipairs(pCon:GetChildren()) do c:Destroy() end
					zeroCreatBP() --zero the bodyposition of the 
					creat.Position = oPCreat
					coms2:FireClient(occ.Value, "ResetUI")
				elseif creat.Position.Y > creatLim then --detect the need of new parts
					fill()
				end
				--if playing then unAnchorClose()end
			elseif playing and hex.Anchored then --detect a new game
				hex.Anchored = false
				hex.CanCollide = true
				stab.D = stabData["D"]
				stab.P = stabData["P"]
			end
		end
	end
end

May I ask, how did you make the corner shaped bricks?

This
image

If this is a union, there may be some slight imperfections with the collisions of the brick.


As seen in the image above, you can see that the two bricks do not align properly even though they are the exact same. You may want to turn on the studio property ShowDecompositionGeometry by navigating to File > Settings > Physics > ShowDecompositionGeometry and see if there are any imperfections with the brick’s geometry, because by the looks of the photo in the OP, all of the bricks like this:

image

seem to repel/push anything in this area:

image

This is all theoretical, hope this helps :slight_smile:

2 Likes

Try to use this brick that I created, its the same shape with the one I mentioned earlier and it aligns perfectly with other bricks similar to it

(It consists of two Parts and one Weld Constraint)

Elbow Brick.rbxm (2.7 KB)

1 Like

Wait, so how exactly would i fix an imperfection with the collision box? Cause im fairly certain i made it exact. And i used Ctrl + D a lot to ensure exactness…
Also, i made the L shape with unions…

Geometric imperfections are not really easy to fix or can’t be fixed at all. It’s a known issue that unioning parts may create geometric imperfections and there are not a lot of options for going around this.

You can’t fix it. Unions have non-exact collision boxes, and you can’t manually modify them. Do not rely on unions having accurate collision boxes.

Instead, you need to use plain parts, such as those in the model @wevetments posted.


If you’re stuck in a situation where you need a union for looks, but the collisions are inaccurate, then you can weld invisible, CanCollide = true parts to a visible, CanCollide = false union. This will give you the collision of the parts with the looks of the union.

In this specific scenario, your shapes are simple enough that you should just use parts.

5 Likes

Would meshes work better than unions, or would that just make the entire situation worse?

Meshes have the same collision inaccuracies as unions. It will be just as bad as using unions.

1 Like

Found the inaccuracies. There was one union which had the collisions I wanted, so I simply duplicated that one. Thank you very much.

2 Likes