How to make raycast hit the part its starting position is inside of?

So I made a custom raycast function that hits parts multiple times (instead of only once like normal raycasts do) but I found out that, if the starting position is inside a part, then it won’t hit the part.

So how can I make it actually hit the part it’s inside of?
The parts I’m using for testing:

Here’s the code for the function, in case it reveals I messed up on something:

function HitboxService.raycastMultiple(start, direction, raycastParams:RaycastParams?):{BasePart}
	local raycastParams = raycastParams or
	local isWhitelist = raycastParams.FilterType == Enum.RaycastFilterType.Whitelist
	local partsRaycast = {}
	while true do
		local hit = workspace:Raycast(start, direction, raycastParams)
		if hit then
			local hitPart = hit.Instance
			table.insert(partsRaycast, hitPart)
			local filterDescendantsInstances = raycastParams.FilterDescendantsInstances
			if isWhitelist == true then
				table.remove(filterDescendantsInstances, hitPart)
				table.insert(filterDescendantsInstances, hitPart)
			raycastParams.FilterDescendantsInstances = filterDescendantsInstances
			return partsRaycast
	return partsRaycast

and here I use the module:

local rayStartPosition:Vector3 =  workspace.raycastStartPoint.Position
local rayEndPosition:Vector3 =  workspace.raycastEndPoint.Position

for i, v in ipairs(HitboxService.raycastMultiple(rayStartPosition, rayEndPosition - rayStartPosition)) do

You could approach this in multiple ways.
The two ways that come up to mind immediately are:

  1. Raycast from end to start instead of start to end, could “cause more issues” but should be good enough.
  2. Before raycasting, check the region of the startpos whether or not it hits a part and account for it then raycast normally.

Couldn’t you just check if the position is inside of the part with a little bit of math? That’s going to be a lot more performant than a raycast operation.

I don’t know “the part”; that’s exactly what I’m trying to get with the raycast (specifically, when I use the raycast function, what I would like to happen is for it to also get the part it starts inside of and not ignore it like the current behaviour does).

Was hoping that there was a way to do this with base-raycast. Seems like it’s not possible so I’ll just go with your 2nd method. Should work fine, so thank you!