bitshifter / glam-rs

A simple and fast linear algebra library for games and graphics
Apache License 2.0
1.46k stars 145 forks source link

Add `with_x `, `with_y`, to vector types #490

Closed bitshifter closed 4 months ago

bitshifter commented 4 months ago

Discussed in https://github.com/bitshifter/glam-rs/discussions/404

Originally posted by **silvestrpredko** May 16, 2023 I would to discuss the possibility of adding additional API to `Vec3`. Something like that: ```Rust #[must_use] #[inline] pub fn with_z(mut self, z: f32) -> Self { self.z = z; self } ``` For 2d games a lot of time you need to update only one property from `Vec3`. It would be nice to have this out of the box. What do you think? I plan to add this API but at first want to discuss if it will be accepted, and I just don't waste my time. Thanks
bitshifter commented 4 months ago

Fixed by #493