Code: Select all
dir = (Vector2 - Vector 1).norm();
Code: Select all
dir = (Vector2 - Vector 1).norm();
Code: Select all
function normalize(x, y)
local length = math.sqrt(x*x + y*y)
return x/length, y/length
end
Code: Select all
local dx = x1-x2
local dy = y1-y2
local length = math.sqrt(dx*dx+dy*dy)
local nx = dx/length
local ny = dy/length
You explained it very good and i couldnt get hump to work since it kept throwing "attempting to index local self" errors at me so the function you wrote is very much apprieciated.
Code: Select all
nv = vector:normalized()
Code: Select all
nv = vector.normalized()
That was the issue, i was doing v.normalized instead of v:normalized.Bigfoot71 wrote: ↑Wed Mar 29, 2023 1:38 pm Strange as a problem, when you call normalize on a vector you do it well like thisAnd not like this:Code: Select all
nv = vector:normalized()
...Code: Select all
nv = vector.normalized()
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 8 guests