DEVELOPMENT ENVIRONMENT

~liljamo/bevy_dice

e7fff704c10ba1052680b66cf432efd36dfb5ee8 — Jonni Liljamo 7 hours ago 8c7ddec
feat: allow setting the spawn position
2 files changed, 4 insertions(+), 1 deletions(-)

M crates/bevy_dice/src/lib.rs
M crates/bevy_dice_demo/src/main.rs
M crates/bevy_dice/src/lib.rs => crates/bevy_dice/src/lib.rs +3 -1
@@ 98,6 98,8 @@ pub struct ThrowDie {
    pub variant: DieVariant,
    /// Initial angular velocity, random if not set.
    pub angular_velocity: Option<Vec3>,
    /// Initial position, `Vec3::ZERO` if not set.
    pub position: Option<Vec3>,
    /// Initial rotation, random if not set.
    pub rotation: Option<Quat>,
}


@@ 157,7 159,7 @@ fn throw_die(
            },
        )],
        Transform {
            translation: Vec3::new(0.0, 4.0, 0.0),
            translation: trigger.position.unwrap_or(Vec3::ZERO),
            rotation: trigger
                .rotation
                .unwrap_or_else(|| Quat::from_rng(rng.as_mut())),

M crates/bevy_dice_demo/src/main.rs => crates/bevy_dice_demo/src/main.rs +1 -0
@@ 194,6 194,7 @@ fn ui(mut commands: Commands, mut contexts: EguiContexts, mut r_ui_state: ResMut
                id: r_ui_state.die_id,
                variant: r_ui_state.selected_variant,
                angular_velocity: None,
                position: Some(Vec3::new(0.0, 4.0, 0.0)),
                rotation: None,
            });
            r_ui_state.die_id += 1;