 # What's the most ideal way of making imaginary hitboxes that arent a 1:1 square?

I’m currently making a game where enemies are an imaginary table inside of the server, and I have hitboxes that just use simple magnitude checking.

One thing that stuck with me is how would I make attacks that are in the shape of… lets say a rectangle, how would I create a “rectangle shaped” or any shape hitbox by just using magnitude checks?

I currently have this version

``````local custmagnitudeCheck = function(p0, p1, size)
local p0x, p0y, p0z = Vector3.new(p0.X, 0, 0), Vector3.new(0, p0.Y, 0), Vector3.new(0, 0, p0.Z)
local p1x, p1y, p1z = Vector3.new(p1.X, 0, 0), Vector3.new(0, p1.Y, 0), Vector3
new(0, 0, p1.Z)
local bool = false

local mx, my, mz = (p0x - p1x).Magnitude, (p0y - p1y).Magnitude, (p0z - p1z).Magnitude

if mx <= size.X and my <= size.Y and mz = size.Z then bool = true end

return bool
end
``````

but I don’t think it will work out great, as it doesnt have some check that gives which side of the hitbox is the enemy vector3 value nearest at.

I prefer not to use collision checks, as I said. The enemies are just a table inside of a serverscript.

You don’t use magnitude you use zone checks. You could use spatial querry or use zone plus.

what’s a zone check? I gotta remind you I’m checking if a vector3 contained in a table is inside a supposed shape that isnt a square using magnitude checks