You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining const Transforms is already possible using glam's macros. I think this is clearer than most equivalent macro impls as its explicit about each field:
use bevy_math::*;pubconstIDENTITY:Transform = Transform{translation:const_vec3!([0.0,0.0,0.0]),rotation:const_quat!([0.0,0.0,0.0,1.0]),scale:const_vec3!([0.0,0.0,0.0]),};
What problem does this solve or what need does it fill?
Transform
s are common configuration points, but there's no current way to initialize them as constants that are easily referred to and shared.What solution would you like?
Follow the example set by glam and provide const fn and macros to initialize const
Transform
structs.What alternative(s) have you considered?
Currently, I'm just storing these values as local non-const variables within my systems.
You could instead use resources as pseudo-consts?
In heavier games, you could also store this information as part of a scene.
Additional context
Inspired by work in #2094, but out of scope for that.
See bitshifter/glam-rs#76 for more discussion on the challenges involved in doing so, and why they can't just use simple
const fn
.For those familiar with Rust's macro system, this should be a simple enough first issue and require very little knowledge of Bevy's internals.
The text was updated successfully, but these errors were encountered: