mesh generation
This commit is contained in:
10
engine/world_generation/src/hex_utils.rs
Normal file
10
engine/world_generation/src/hex_utils.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub const OUTER_RADIUS: f32 = 1.;
|
||||
pub const INNER_RADIUS: f32 = OUTER_RADIUS * 0.866025404;
|
||||
|
||||
|
||||
pub fn to_hex_pos(pos: Vec3) -> Vec3 {
|
||||
let x = (pos.x + pos.z * 0.5 - (pos.z / 2.).floor()) * (INNER_RADIUS * 2.);
|
||||
return Vec3::new(x, pos.y, pos.z * OUTER_RADIUS * 1.5);
|
||||
}
|
||||
Reference in New Issue
Block a user