BlackPhlox / bevy_dolly

h3r2tic's dolly abstraction layer for the bevy game framework
Apache License 2.0
143 stars 22 forks source link

Make Rig builder follow Bevy's current paradigm of passing tuples #33

Open janhohenheim opened 1 year ago

janhohenheim commented 1 year ago

As Bevy changed the API for bundle and system (and soon plugin) adding to accept tuples instead of multiple calls to a builder function, I think we should follow suit:

Rig::builder()
    .with(Position::new(Vec3::ZERO))
    .with(YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0))
    .with(Smooth::new_position(0.3))
    .with(Smooth::new_rotation(0.3))
    .with(Arm::new(Vec3::Z * 4.0))
    .build()

becomes

Rig::builder()
    .with((
        Position::new(Vec3::ZERO),
        YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0),
        Smooth::new_position(0.3),
        Smooth::new_rotation(0.3),
        Arm::new(Vec3::Z * 4.0)
    ))
    .build()
janhohenheim commented 1 year ago

Nevermind, just realized this is a consequence of dolly's design

BlackPhlox commented 1 year ago

I mean it is more ergonomic, we could change the api in dolly submodule and upstream the changes to real dolly project. You got me hooked, I'm reopning this :)

BlackPhlox commented 1 year ago

There is a relevant implementation of plugins tuple in bevy, we might be able to resuse the all_tuples macro referenced here