Skip to content

Commit

Permalink
respect placement orientation of block in building example (#532)
Browse files Browse the repository at this point in the history
In the building example, respect the `face` of the interaction event to
allow placing the block in the proper direction.
  • Loading branch information
tsatke authored Sep 20, 2023
1 parent df4f0f6 commit 9c02b0e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/building.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 9c02b0e

Please sign in to comment.