method
Vector.normalize
Vector.normalize(v) -> Vector
Returns a unit-length vector pointing the same way as v. The zero vector maps to itself, so this never divides by zero. Scale the result by a speed to build a velocity.
Example
program Demo {
handler Step phase Update {
let dir = Vector.normalize(Vector.sub(target, pos))
}
}