Shapecast hitbox inaccurate

Hello guys, I am currently using Shapecast as my hitbox for a melee combat that I have.

The issue with this is that when I am up close to a target, for some reason the hitbox does not work.

However, when I am in a reasonable distance away from the target, it works.

Here is my code and an example of the hitbox.

Any response will be heavily appreciated!

local function castHitbox(params, char)
	local hrp = char.HumanoidRootPart
	
	local size = Vector3.new(7,5,10);
	
	local direction = hrp.CFrame.LookVector;
	
	local result = workspace:Blockcast(hrp.CFrame, size, direction, params);
	Visualiser:Blockcast(hrp.CFrame, size, direction, params);
	
	if result then
		print("Hello!")
	end
end

local function HitboxOnAnim(CurrentCombo, plr)
	local params = RaycastParams.new();
	params.FilterDescendantsInstances = {plr.Character};
	params.FilterType = Enum.RaycastFilterType.Exclude;
	
	castHitbox(params, plr.Character)
end


Shapecasts sweep a shape through a space, which i believe is not what u are going for
Spatial queries get parts that are within a shape, WorldRoot | Documentation - Roblox Creator Hub

1 Like

I see, I’ve always thought shapecasts were the way to go with the hitboxes.
I will experiment with spatial queries and see if I can get the desired result.

Thank you for the response!

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