From 9c02b0e3eaa76e7623828742d2f17fb90db8772f Mon Sep 17 00:00:00 2001 From: Tim Satke <48135919+tsatke@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:48:12 +0200 Subject: [PATCH] respect placement orientation of block in `building` example (#532) In the building example, respect the `face` of the interaction event to allow placing the block in the proper direction. --- examples/building.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/building.rs b/examples/building.rs index cf3484946..cbf6e774d 100644 --- a/examples/building.rs +++ b/examples/building.rs @@ -160,6 +160,14 @@ fn place_blocks( } } let real_pos = event.position.get_in_direction(event.face); - layer.set_block(real_pos, block_kind.to_state()); + let state = block_kind.to_state().set( + PropName::Axis, + match event.face { + Direction::Down | Direction::Up => PropValue::Y, + Direction::North | Direction::South => PropValue::Z, + Direction::West | Direction::East => PropValue::X, + }, + ); + layer.set_block(real_pos, state); } }