Collision Issues

I’m working on an ability for my game that makes some objects have collision and others have no collision, but then for some reason the collision on all the faces of the object don’t properly “update” after a while or unless I equip a gear. I have zero clue what causes it and I think it’s a bug

Part of code that handles the objects:

		for _, AbstractObject in AbstractStuff:GetChildren() do
			if AbstractObject.Name == "AbstractAppear" then
				AbstractObject.Material = "Marble"
				AbstractObject.Color = Color3.fromRGB(255, 255, 255)
				CreateTween(AbstractObject, 1, {Color = Color3.fromRGB(0, 0, 255)}, Enum.EasingStyle.Exponential)
				CreateTween(AbstractObject, 1, {Transparency = 0}, Enum.EasingStyle.Exponential)
				AbstractObject.CanCollide = true
			elseif AbstractObject.Name == "AbstractRemove" then
				AbstractObject.Material = "Neon"
				AbstractObject.Color = Color3.fromRGB(255, 255, 255)
				CreateTween(AbstractObject, 1, {Color = Color3.fromRGB(0, 255, 255)}, Enum.EasingStyle.Exponential)
				CreateTween(AbstractObject, 1, {Transparency = 0.75}, Enum.EasingStyle.Exponential)
				AbstractObject.CanCollide = false
			end
		end

I had this problem, and it was because I was using ControllerManager with a customized GroundSensor (ControllerPartSensor) that detected the ground by casting a ray downward.

To fix it, I added this line of code:

rayCastParams.RespectCanCollide = true

to the RaycastParams.new() used by the sensor. Maybe you have a similar problem.

1 Like