#physics #bevy-serialization-extras #plugin #serialization #rapier #wrapper #group

bevy_serialization_physics

A crate for adding physics wrappers for bevy_serialization_extras

11 releases (6 breaking)

Uses new Rust 2024

new 0.7.0 Mar 19, 2025
0.6.0 Jan 1, 2025
0.5.0 Nov 20, 2024
0.2.2 Mar 20, 2024

#4 in #rapier

Download history 12/week @ 2024-11-29 7/week @ 2024-12-06 3/week @ 2024-12-13 131/week @ 2024-12-27 41/week @ 2025-01-03 6/week @ 2025-01-10 3/week @ 2025-01-31 2/week @ 2025-02-07 20/week @ 2025-02-14 9/week @ 2025-02-21 59/week @ 2025-02-28 90/week @ 2025-03-07 104/week @ 2025-03-14

262 downloads per month
Used in 3 crates (2 directly)

MIT license

94KB
2K SLoC

Rust 1.5K SLoC // 0.1% comments Rusty Object Notation 295 SLoC

bevy_serialization_extras

A library for component oriented serialization.

Features

  • Out of the box serialization Through plugins for components
// Component <-> WrapperComponent
.add_plugins(SerializeComponentFor::<AsyncCollider, ColliderFlag>::default())

// Asset <-> WrapperComponent
.add_plugins(SerializeAssetFor::<MeshMaterial3d<StandardMaterial>, MaterialFlag3d>::default())
// Query -> Component, 
.add_plugins(SerializeQueryFor::<Linkage, ImpulseJoint, JointFlag>::default())
  • Serialization of groups of enities that compose an asset into their singular asset equivillent, and vice-versa

A visualization util to list serializable/unserializable components(W.I.P) [bevy_serialization_core]

demo_gif.webm

Visualize and edit 3rd party components that do not Reflect

E.G: Edit Rapier's ImpulseJoint through JointFlag [bevy_serialization_physics]

edit_example.png

Serialize a collection of entities into an Asset that is composed of them

E.G: serialize the parts of a robot into a Urdf [bevy_serialization_assemble]

//(entity_0, ... entity_n) -> Asset
// [UNIMPLEMENTED] Asset -> (entity_0, ... entity_n)
.add_plugins(SerializeManyAsOneFor::<LinkQuery, Urdf>::default())

https://github.com/user-attachments/assets/fb1a1b09-db3f-4476-9b0d-800b296ccb8a

Why bevy_serialization_extras?

  • bevy_serialization_extras is built ontop of bevy_reflect, not serde. No need to double dip to serialize.

  • bevy_serialization_extras allows regular serialization into .ron via moonshine_save + allows converting serializables into more stable file formats via bevy_serialization_assemble.

serde serialization:

world <--> scene.json

bevy_serialziation_extras:

(object) <--> (partA, partB) <--> .file
(person) (body + arm_0...arm_n + leg_0..leg_n) <--> .file
world <--> scene.ron

This is good for creating editors in bevy.

Credits

moonshine_save for the save/load backend of this library

Usage

See sub-crate /examples files for example usage.


lib.rs:

A crate that extends bevy_serialization_extras to include bevy <-> Rapier serialization support.

Dependencies

~51–83MB
~1.5M SLoC