So I’m starting to get into the whole math aspect of scripting, tried to avoid it as long as possible but now its time to learn even as much as I suck at it going through every little bit 1 by 1,
When I use .Normal
on my raycast result, I consistently obtain values like -1,0,0 or 1,0,0, which aligns with expectations. However, my custom implementation returns values such as -1, 0.2904, 0.255, deviating from what I anticipate. (-1 never changes)
Maybe what I made is wildly in which case do correct me but as far as I’m aware I followed a formula which Is suppose to get the normal of a vector:
function MetaTable:Normalize(raycastResult)
local vector = raycastResult.Position
local vectorLength = math.sqrt(vector.x ^ 2, vector.Y ^ 2, vector.Z ^ 2)
return Vector3.new((vector.X / vectorLength), (vector.Y / vectorLength), (vector.Z / vectorLength))
end