Hologram Table and Mathematics

I have been working on a hologram table recently but the math seems to be slightly off. I set a Vector3 to 0,0,0 and it somehow lands slightly above the part’s center. I’ll show you exactly what I’m calculating.

Equations:

local isoverof = function(is,percent)
	-- Formula: is(x)/of(y) = percent(%)/100
	if type(is) == "userdata" and type(percent) == "userdata" then
		return Vector3.new((percent.x/100)*is.x,(percent.y/100)*is.y,(percent.z/100)*is.z);
	else
		return (percent/100)*is;
	end
end

local convertToScalarSize = function(v3_1,v3_2,v3_3)
	-- v3_1 is the Hologram Model's world position. v3_2 is the Hologram Model's size. v3_3 is the Vehicle's world position.
	local localspace = isoverof((v3_3-v3_1),v3_2/2);
	
	return localspace + v3_1;
end

Errors:
https://gyazo.com/9ff13804ee2badd48e83277502a4db10
As you can see above, the indicators are off. Am I calculating this wrong?

Made a janky fix that seems to work for now. If anyone has a much better alternative, please specify.

Result:
https://gyazo.com/a4f8b27de1c16a7ec3318ae127092a17

Equation:

local convertToScalarSize = function(v3_1,v3_2,v3_3)
	-- v3_1 is the Hologram Model's world position. v3_2 is the Hologram Model's size. v3_3 is the Vehicle's world position.
	local localspace = isoverof((v3_3-v3_1),v3_2)+Vector3.new((v3_2/2).x,0,1);
	
	return localspace + v3_1;
end
2 Likes