wait(4)
local brokenVec3 = Vector3.new(0.000000000000000000000000000000001,0,0)
print(brokenVec3, " : ", brokenVec3.Magnitude) -- prints 1.00000002e-33, 0, 0 : 0
print(brokenVec3 == Vector3.new()) --prints false
if brokenVec3 ~= Vector3.new() then
game.Players.LocalPlayer:Move(brokenVec3) -- this sets the position to NaN
end
There is a very rare problem with Vector3. Basically, what happens is that very small Vector3 are not defaulted to (0,0,0), but their magnitudes are. This makes it so calling BrokenVector3.Unit on a very small Vector will cause the game to do BrokenVector3 / BrokenVector3.Magnitude
which translates to (1.00000002e-33, 0, 0) / 0
which creates a NaN. The solutions to this are two:
First, make it so Vector3.Unit cannot return a NaN, instead, have it default to (0,0,0) or (1,0,0)
Second, make it so very small numbers in vectors are also turned into 0, this way, checking if a very small vectors equals (0,0,0) will return true and prevent you from creating a NaN you did not expect.
I’m sorry if this isn’t the right category, but i don’t have the permissions to post into the Engine Bugs section of the forum. Thank you.