Skip to content

More idiomatic component/resource checksums for float types? #55

@johanhelsing

Description

@johanhelsing

Is your feature request related to a problem? Please describe.

It's very useful to have desync detection for things like player positions etc. However if your player positions are Transform or glam::Vec3s or similar this currently requiries implementing Hash for those types, which is perhaps not ideal, as Hash isn't implemented for f32, and even though it's possible to do so (using e.g. to_bits), it is perhaps a bit of a footgun for other code that assumes a more correct Hash implementation

Describe the solution you'd like
I'm not sure exactly how I'd like this solved, but perhaps another trait and/or derive could solve it. I'd essentially just want to do:

#[derive(Reflect, Component, bevy_ggrs::Checksum]
#[reflect(Checksum)]
struct Foo(f32);

Describe alternatives you've considered
Maybe this is an issue with bevy_reflect, not sure what #[reflect(hash)] is typically used for outside bevy_ggrs... Maybe this is just the way we have to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions