Not detecting non collidable part with get partinbound

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Placement system

  2. What is the issue? It doesn’t detect the collision box, a non collideable and non touchable box that defines the premise of an object

  3. What solutions have you tried so far? Debug it by creating a part to represent the hitbox, And the hitboxes seemed to intersect and be right

Video:Desktop 2023.03.12 - 21.35.07.05
SCRIPT:

local function checkIntersect(obj1,fold)
	local overlap = OverlapParams.new()
	overlap.FilterDescendantsInstances = {fold}
	print(fold:GetChildren())
	overlap.FilterType = Enum.RaycastFilterType.Whitelist
	print(fold)
	local objs = workspace:GetPartBoundsInBox(obj1.Box.CFrame,obj1.Box.Size+Vector3.new(0.5,0.5,0.5),overlap)
	local p = Instance.new("Part")
	p.Anchored = true
	p.CFrame = obj1.Box.CFrame
	p.Size = obj1.Box.Size+Vector3.new(0.5,0.5,0.5)
	p.Parent = workspace
	p.CanCollide = false
	p.CanQuery = false
	p.CanTouch = false
	if #objs > 1 then return true end
	return false
end
1 Like

maybe try using regions?

I believe this is caused by p.CanQuery being set to false. Also, make sure the part is a descendant of the “fold” object because the Enum.RaycastFilterType is set to Whitelist.

I also would not recommend using Regions, it is more complicated and plus all Region3 functions are deprecated.

It is set to true and the type is whitelist, But i still dont understand why this would not work

Odd, so the part you are trying to detect has CanQuery set to true? In the code snippet, you listed above it is set as false p.CanQuery = false

Here is what CanQuery does CanQuery Collision Property

No The canquery fasle is not the detection part, Its just the visualization that is provided in the video as the box that getpartinbound represents

It could be because of this line:

if #objs > 1 then return true end

What this line does is only return true if there’s more than 1, not if there’s 1 or more.

Wow never thought that would be a problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.