Detecting if a point is inside a PreciseConvexDecomposition mesh

Is it possible for me to see if a point is inside a mesh part that has its CollisionFidelity set to PreciseConvexDecomposition (so only classifying the point as being inside the mesh part if it’s inside the collision geometry, not the actual mesh part) given that:

  • CanCollide is false
  • The mesh part is having its CFrame set every frame and is anchored
1 Like

pic

What do you need to do this for? Maybe there’s an easier option.

Here’s my way: Make a part which size is vector3.new(0.05, 0.05, 0.05), and the shape Enum.ball.

Then using GetTouchingParts to see if it intersects with the mesh. (GetTouchingParts uses the collision geometry of the part).



local CachedPart;

local function IsPointInPart(Part: BasePart, Point)
	local Connection = Part.Touched:Connect(function() end) -- Connect a touchedevent to add a touchtransimitter. (Makes it work for non cancollide parts) 
	
	
	
	if CachedPart == nil then
		CachedPart = Instance.new('Part')
		CachedPart.Shape = Enum.PartType.Ball
		CachedPart.CanCollide =  true
		CachedPart.Parent = workspace
		CachedPart.Transparency = 1
		CachedPart.Anchored = true
                CachedPart.Position = Point
	end	
	
	
	for i,v in pairs(CachedPart:GetTouchingParts()) do
		if v == Part then
			Connection:Disconnect()
			return true
		end
	end

	Connection:Disconnect()
	return false
end

Also an other way to do this is by using region3.