@@ 53,6 53,8 @@ pub struct DicePluginConfig {
///
/// Can also be used to just override the values of faces.
pub override_face_positions: HashMap<DieVariant, HashMap<u8, u8>>,
+ /// Scale overrides, used to size the dice.
+ pub override_scales: HashMap<DieVariant, f32>,
}
#[derive(Reflect, Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ 147,6 149,11 @@ fn throw_die(
None => Quat::default(),
};
+ let scale = match r_config.override_scales.get(&trigger.variant) {
+ Some(scale) => Vec3::splat(*scale),
+ None => Vec3::splat(1.0),
+ };
+
let mut die = commands.spawn((
Visibility::Inherited,
// Place the mesh in a child to allow correcting the rotation.
@@ 163,7 170,7 @@ fn throw_die(
rotation: trigger
.rotation
.unwrap_or_else(|| Quat::from_rng(rng.as_mut())),
- ..Default::default()
+ scale,
},
RigidBody::Dynamic,
Collider::convex_hull_from_mesh(mesh).unwrap(),
@@ 159,6 159,12 @@ fn setup(
(100, 100),
]),
)]),
+ override_scales: HashMap::from([
+ (DieVariant::D10, 0.8),
+ (DieVariant::D10P, 0.8),
+ (DieVariant::D12, 0.8),
+ (DieVariant::D20, 0.8),
+ ]),
});
}