Expand description
§Lightweight, zero-dependency, type-agnostic library for vector math.
let mut position = consts::f32::ZERO;
let target = vec2(10.0, 5.0);
let speed = 2.0;
let direction = (target - position).normalize();
position += direction * speed;
println!("Moving towards {target}");
println!("New position: {position}");Modules§
- vec2
- Module for working with two-dimensional vectors