-
Hi! im very new to rust but i must say that bevy is very easy to use and understand - i would say i learned the basics of rust just of 2 hours with bevy :D - but i have one problem. Digging in Vec2 there is no implementation of converting from a Vec3 to a Vec2. So half of my code looks like this: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Why not use The example the code you've given would then use |
Beta Was this translation helpful? Give feedback.
-
You can import the swizzle methods from bevy::math::swizzles which lets you do some_vec.xy() or .xz() for example to turn it into a vec2 |
Beta Was this translation helpful? Give feedback.
Why not use
Vec3::truncate
to convert from aVec3
to aVec2
?The example the code you've given would then use
Vec2::extend
, i.e.transform.translation.truncate().extend(0.0)