vec2ScaleToLength
vec2ScaleToLength(
v,length):Vec2
Defined in: src/modules/math/vec2.ts:22
v rescaled so its length equals length, direction preserved — the
canonical “normalize then multiply” for driving a body at a fixed speed from
an arbitrary direction (input axis, steering delta, reflected velocity). A
zero-length input returns { x: 0, y: 0 }. Sibling of vec3ScaleToLength.
Parameters
Section titled “Parameters”length
Section titled “length”number