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.