VectorA:normalize
From ComputerCraft Wiki
Returns a normal vector with a length of 1
Code representation:
local a = vector.new(1, 2, 3) local len = a:length() local c = vector.new(a.x / len, a.y / len, a.z / len) --c.x = 0.26726124 --c.y = 0.5345225 --c.z = 0.80178374
Code example:
local a = vector.new(1, 2, 3) local c = a:normalize() print(c.x) print(c.y) print(c.z) print(c:length()) --0.26726124 --0.5345225 --0.80178374 --1