gschup/bevy_ggrs

Usability with non trivial reflectable types

JonathanPicques opened this issue · 1 comments

I wanted to integrate a fixed point library to ease deterministic computations, but I face a big wall since I16F16 does not implement Reflect and the implementation is far from trivial

What would be the course of action to be able to use such structs easily with register_rollback_type?

use fixed::{traits::Fixed, types::I16F16};

#[derive(Default)]
pub struct Velocity {
    pub x: I16F16,
    pub y: I16F16,
}

Throws

.register_rollback_type::<Vector2D>();
^^^^^^^^^^^^^^^^^^^^^^ the trait `bevy::prelude::Reflect` is not implemented for `Velocity`

If you cannot #[derive(Reflect)], then it is indeed going to be complicated. I currently don't have a good answer for you. I will ask around, though.