Updated to Bevy 0.15.1
This commit is contained in:
1747
Cargo.lock
generated
1747
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -9,5 +9,5 @@ edition = "2021"
|
||||
[dependencies]
|
||||
serde = "1.0.204"
|
||||
serde_json = "1.0.120"
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
ron = "0.8.1"
|
||||
|
||||
@@ -29,12 +29,12 @@ macro_rules! create_asset_loader {
|
||||
|
||||
type Error = String;
|
||||
|
||||
async fn load<'a>(
|
||||
&'a self,
|
||||
reader: &'a mut Reader<'_>,
|
||||
_settings: &'a Self::Settings,
|
||||
load_context: &'a mut LoadContext<'_>,
|
||||
) -> Result<Self::Asset, Self::Error> {
|
||||
async fn load(
|
||||
&self,
|
||||
reader: & mut dyn bevy::asset::io::Reader,
|
||||
_: &Self::Settings,
|
||||
load_context: &mut LoadContext<'_>,
|
||||
) -> Result<Self::Asset, Self::Error> {
|
||||
let mut bytes = Vec::new();
|
||||
let read_result = reader.read_to_end(&mut bytes).await;
|
||||
if read_result.is_err() {
|
||||
|
||||
@@ -9,5 +9,5 @@ proc-macro = true
|
||||
[dependencies]
|
||||
serde = "1.0.204"
|
||||
serde_json = "1.0.120"
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
ron = "0.8.1"
|
||||
|
||||
@@ -6,14 +6,14 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
noise = "0.9.0"
|
||||
serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.115"
|
||||
asset_loader = { path = "../asset_loader" }
|
||||
rayon = "1.10.0"
|
||||
bevy-inspector-egui = "0.25.0"
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy-inspector-egui = "0.28.1"
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
use std::ops::Add;
|
||||
|
||||
use bevy::{math::VectorSpace, prelude::*};
|
||||
use bevy::{asset::AssetLoader, math::VectorSpace, prelude::*};
|
||||
use image::ImageBuffer;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::hex_utils::HexCoord;
|
||||
|
||||
use super::{
|
||||
biome_map::BiomeMap,
|
||||
chunk::Chunk,
|
||||
map::Map,
|
||||
};
|
||||
use super::{biome_map::BiomeMap, chunk::Chunk, map::Map};
|
||||
|
||||
pub fn render_image(
|
||||
size: UVec2,
|
||||
@@ -40,7 +36,7 @@ pub fn update_image(
|
||||
let idx = (y * w + x) as usize;
|
||||
let v = data[idx];
|
||||
let t = v.remap(min, max, 0.0, 1.0);
|
||||
let col = LinearRgba::lerp(&color1, color2, t);
|
||||
let col = LinearRgba::lerp(color1, color2, t);
|
||||
*pixel = to_pixel(&col);
|
||||
});
|
||||
}
|
||||
@@ -95,10 +91,10 @@ fn get_height_color_blend(base_color: Hsla, height: f32, height2: f32, smooth: f
|
||||
d /= smooth;
|
||||
if d > 0.0 {
|
||||
let c2: LinearRgba = color.with_lightness(color.lightness + 0.1).into();
|
||||
color = LinearRgba::lerp(&color.into(), c2, d).into();
|
||||
color = LinearRgba::lerp(color.into(), c2, d).into();
|
||||
} else {
|
||||
let c2: LinearRgba = color.with_lightness(color.lightness - 0.1).into();
|
||||
color = LinearRgba::lerp(&color.into(), c2, d.abs()).into();
|
||||
color = LinearRgba::lerp(color.into(), c2, d.abs()).into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
shared = { path = "../shared" }
|
||||
bevy_rapier3d = "0.27.0"
|
||||
bevy_rapier3d = "0.28.0"
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
asset_loader = { path = "../../engine/asset_loader" }
|
||||
serde_json = "1.0.120"
|
||||
ron = "0.8.1"
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
|
||||
@@ -51,17 +51,18 @@ impl BuildingAsset {
|
||||
if let Some(gltf_mesh) = meshes.get(mesh_handle.id()) {
|
||||
let (mesh, mat) = gltf_mesh.unpack();
|
||||
let mut entity = commands.spawn((
|
||||
PbrBundle {
|
||||
mesh,
|
||||
material: mat,
|
||||
transform: Transform::from_translation(pos).with_rotation(rot),
|
||||
..Default::default()
|
||||
},
|
||||
Mesh3d(mesh),
|
||||
MeshMaterial3d(mat),
|
||||
Transform::from_translation(pos).with_rotation(rot),
|
||||
Building,
|
||||
));
|
||||
entity.with_children(|b| {
|
||||
for child in &node.children {
|
||||
self.process_node(child, meshes, b, &node.name);
|
||||
let child_node = nodes.get(child.id());
|
||||
if child_node.is_none() {
|
||||
continue;
|
||||
}
|
||||
self.process_node(child_node.unwrap(), meshes, nodes, b, &node.name);
|
||||
}
|
||||
});
|
||||
if let Some(component) = self.get_component_def(&format!("/{0}", &node.name)) {
|
||||
@@ -78,6 +79,7 @@ impl BuildingAsset {
|
||||
&self,
|
||||
node: &GltfNode,
|
||||
meshes: &Assets<GltfMesh>,
|
||||
nodes: &Assets<GltfNode>,
|
||||
commands: &mut ChildBuilder,
|
||||
parent: &String,
|
||||
) -> Option<Entity> {
|
||||
@@ -85,18 +87,14 @@ impl BuildingAsset {
|
||||
if let Some(mesh) = &node.mesh {
|
||||
if let Some(gltf_mesh) = meshes.get(mesh.id()) {
|
||||
let (mesh, mat) = gltf_mesh.unpack();
|
||||
let mut entity = commands.spawn((
|
||||
PbrBundle {
|
||||
mesh,
|
||||
material: mat,
|
||||
transform: node.transform,
|
||||
..Default::default()
|
||||
},
|
||||
Building,
|
||||
));
|
||||
let mut entity = commands.spawn((Mesh3d(mesh), MeshMaterial3d(mat), node.transform, Building));
|
||||
entity.with_children(|b| {
|
||||
for child in &node.children {
|
||||
self.process_node(child, meshes, b, &path);
|
||||
let child_node = nodes.get(child.id());
|
||||
if child_node.is_none() {
|
||||
continue;
|
||||
}
|
||||
self.process_node(child_node.unwrap(), meshes, nodes, b, &path);
|
||||
}
|
||||
});
|
||||
if let Some(component) = self.get_component_def(&path) {
|
||||
|
||||
@@ -110,12 +110,9 @@ fn hq_placement(
|
||||
fn show_indicators(positions: Vec<Vec3>, commands: &mut Commands, indicator: &IndicatorCube) {
|
||||
for p in positions {
|
||||
commands.spawn((
|
||||
PbrBundle {
|
||||
mesh: indicator.0.clone(),
|
||||
material: indicator.1.clone(),
|
||||
transform: Transform::from_translation(p),
|
||||
..default()
|
||||
},
|
||||
Mesh3d(indicator.0.clone()),
|
||||
MeshMaterial3d(indicator.1.clone()),
|
||||
Transform::from_translation(p),
|
||||
Despawn,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ build = "build.rs"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.14.2", features = ["file_watcher"] }
|
||||
bevy-inspector-egui = "0.25.0"
|
||||
iyes_perf_ui = "0.3.0"
|
||||
bevy = { version = "0.15.1", features = ["file_watcher"] }
|
||||
bevy-inspector-egui = "0.28.1"
|
||||
# iyes_perf_ui = "0.3.0"
|
||||
noise = "0.8.2"
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
bevy_rapier3d = { version = "0.27.0", features = [
|
||||
bevy_rapier3d = { version = "0.28.0", features = [
|
||||
"simd-stable",
|
||||
"parallel",
|
||||
"debug-render-3d",
|
||||
@@ -21,13 +21,13 @@ rayon = "1.10.0"
|
||||
buildings = { path = "../buildings" }
|
||||
units = { path = "../units" }
|
||||
shared = { path = "../shared" }
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
ron = "0.8.1"
|
||||
image = "0.25.2"
|
||||
bevy_lunex = "0.2.4"
|
||||
# bevy_lunex = "0.2.4"
|
||||
|
||||
[features]
|
||||
tracing = [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin};
|
||||
use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin, TemporalAntiAliasing};
|
||||
use bevy::core_pipeline::prepass::DepthPrepass;
|
||||
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
|
||||
use bevy::prelude::*;
|
||||
@@ -44,22 +44,21 @@ fn init_bounds(
|
||||
});
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands, mut msaa: ResMut<Msaa>) {
|
||||
fn setup(mut commands: Commands) {
|
||||
commands
|
||||
.spawn((
|
||||
Camera3dBundle {
|
||||
transform: Transform::from_xyz(0., 30., 0.).looking_to(Vec3::NEG_Z, Vec3::Y),
|
||||
..default()
|
||||
},
|
||||
Camera3d::default(),
|
||||
Transform::from_xyz(0., 30., 0.).looking_to(Vec3::NEG_Z, Vec3::Y),
|
||||
PhosCamera::default(),
|
||||
MainCamera,
|
||||
DepthPrepass,
|
||||
PhosOrbitCamera::default(),
|
||||
TemporalAntiAliasing::default(),
|
||||
))
|
||||
// .insert(RenderLayers::layer(0))
|
||||
.insert(TemporalAntiAliasBundle::default());
|
||||
.insert(Msaa::Off);
|
||||
// .insert(RenderLayers::layer(0))
|
||||
|
||||
*msaa = Msaa::Off;
|
||||
// *msaa = Msaa::Off;
|
||||
}
|
||||
|
||||
fn orbit_camera_upate(
|
||||
@@ -87,24 +86,24 @@ fn orbit_camera_upate(
|
||||
for e in mouse_motion.read() {
|
||||
orbit_move += e.delta;
|
||||
}
|
||||
orbit_move *= config.pan_speed * time.delta_seconds() * -1.0;
|
||||
orbit_move *= config.pan_speed * time.delta_secs() * -1.0;
|
||||
let rot_y = Quat::from_axis_angle(Vec3::Y, orbit_move.x);
|
||||
let right = orbit.forward.cross(Vec3::Y).normalize();
|
||||
let rot_x = Quat::from_axis_angle(right, orbit_move.y);
|
||||
orbit.forward = rot_x * rot_y * orbit.forward;
|
||||
// orbit.forward.y = orbit.forward.y.clamp(-0.9, 0.0);
|
||||
orbit.forward = orbit.forward.normalize();
|
||||
window.cursor.grab_mode = CursorGrabMode::Locked;
|
||||
window.cursor.visible = false;
|
||||
window.cursor_options.grab_mode = CursorGrabMode::Locked;
|
||||
window.cursor_options.visible = false;
|
||||
} else {
|
||||
window.cursor.grab_mode = CursorGrabMode::None;
|
||||
window.cursor.visible = true;
|
||||
window.cursor_options.grab_mode = CursorGrabMode::None;
|
||||
window.cursor_options.visible = true;
|
||||
}
|
||||
if key.pressed(KeyCode::KeyE) {
|
||||
let rot = Quat::from_axis_angle(Vec3::Y, f32::to_radians(config.speed) * time.delta_seconds());
|
||||
let rot = Quat::from_axis_angle(Vec3::Y, f32::to_radians(config.speed) * time.delta_secs());
|
||||
orbit.forward = rot * orbit.forward;
|
||||
} else if key.pressed(KeyCode::KeyQ) {
|
||||
let rot = Quat::from_axis_angle(Vec3::Y, f32::to_radians(-config.speed) * time.delta_seconds());
|
||||
let rot = Quat::from_axis_angle(Vec3::Y, f32::to_radians(-config.speed) * time.delta_secs());
|
||||
orbit.forward = rot * orbit.forward;
|
||||
}
|
||||
|
||||
@@ -137,7 +136,7 @@ fn orbit_camera_upate(
|
||||
gizmos.arrow(orbit.target, orbit.target + move_fwd, LinearRgba::WHITE.with_alpha(0.5));
|
||||
gizmos.arrow(orbit.target, orbit.target - (move_rot * cam_move), LinearRgba::BLUE);
|
||||
}
|
||||
orbit.target -= (move_rot * cam_move) * move_speed * time.delta_seconds();
|
||||
orbit.target -= (move_rot * cam_move) * move_speed * time.delta_secs();
|
||||
orbit.target.y = sample_ground(orbit.target, &map);
|
||||
|
||||
orbit.target.x = orbit.target.x.clamp(bounds.min.x, bounds.max.x);
|
||||
@@ -152,7 +151,7 @@ fn orbit_camera_upate(
|
||||
}
|
||||
}
|
||||
|
||||
orbit.distance -= scroll * time.delta_seconds() * config.zoom_speed;
|
||||
orbit.distance -= scroll * time.delta_secs() * config.zoom_speed;
|
||||
orbit.distance = orbit.distance.clamp(config.min_height, config.max_height);
|
||||
|
||||
// let ground_below_cam = sample_ground(cam_pos, &map) + config.min_height;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::env;
|
||||
|
||||
use bevy::image::{ImageAddressMode, ImageFilterMode, ImageSamplerDescriptor};
|
||||
use bevy::pbr::wireframe::WireframePlugin;
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::texture::{ImageAddressMode, ImageFilterMode, ImageSamplerDescriptor};
|
||||
use bevy::window::PresentMode;
|
||||
use bevy_inspector_egui::quick::WorldInspectorPlugin;
|
||||
use phos::PhosGamePlugin;
|
||||
|
||||
@@ -73,14 +73,14 @@ fn chunk_rebuilder(
|
||||
}
|
||||
|
||||
fn collider_task_resolver(
|
||||
mut chunks: Query<(&mut ChunkRebuildTask, &Handle<Mesh>), With<PhosChunk>>,
|
||||
mut chunks: Query<(&mut ChunkRebuildTask, &Mesh3d), With<PhosChunk>>,
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
) {
|
||||
for (mut task, mesh_handle) in &mut chunks {
|
||||
if let Some((mut c, mesh)) = futures::check_ready(&mut task.task) {
|
||||
commands.append(&mut c);
|
||||
meshes.insert(mesh_handle, mesh);
|
||||
meshes.insert(mesh_handle.id(), mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,12 +252,9 @@ fn spawn_map(
|
||||
// let mesh_handle = meshes.a
|
||||
let chunk = commands
|
||||
.spawn((
|
||||
MaterialMeshBundle {
|
||||
mesh: meshes.add(chunk_mesh),
|
||||
material: atlas.chunk_material_handle.clone(),
|
||||
transform: Transform::from_translation(pos),
|
||||
..default()
|
||||
},
|
||||
Mesh3d(meshes.add(chunk_mesh)),
|
||||
MeshMaterial3d(atlas.chunk_material_handle.clone()),
|
||||
Transform::from_translation(pos),
|
||||
PhosChunk::new(index),
|
||||
RenderDistanceVisibility::default().with_offset(visibility_offset),
|
||||
collider,
|
||||
@@ -265,12 +262,9 @@ fn spawn_map(
|
||||
.id();
|
||||
let water = commands
|
||||
.spawn((
|
||||
MaterialMeshBundle {
|
||||
mesh: meshes.add(water_mesh),
|
||||
material: atlas.water_material.clone(),
|
||||
transform: Transform::from_translation(pos),
|
||||
..default()
|
||||
},
|
||||
Mesh3d(meshes.add(water_mesh)),
|
||||
MeshMaterial3d(atlas.water_material.clone()),
|
||||
Transform::from_translation(pos),
|
||||
PhosChunk::new(index),
|
||||
NotShadowCaster,
|
||||
RenderDistanceVisibility::default().with_offset(visibility_offset),
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use crate::camera_system::components::PhosCamera;
|
||||
use crate::map_rendering::map_init::MapInitPlugin;
|
||||
use crate::map_rendering::render_distance_system::RenderDistancePlugin;
|
||||
use crate::ui::game::build_ui::BuildUiPlugin;
|
||||
use crate::ui::lunex_setup_plugin::LunexSetupPlugin;
|
||||
use crate::utlis::editor_plugin::EditorPlugin;
|
||||
use crate::utlis::tile_selection_plugin::TileSelectionPlugin;
|
||||
use crate::{camera_system::camera_plugin::PhosCameraPlugin, utlis::debug_plugin::DebugPlugin};
|
||||
@@ -15,7 +13,7 @@ use bevy_rapier3d::dynamics::{Ccd, RigidBody, Velocity};
|
||||
use bevy_rapier3d::geometry::Collider;
|
||||
use bevy_rapier3d::plugin::{NoUserData, RapierPhysicsPlugin};
|
||||
use buildings::BuildingPugin;
|
||||
use iyes_perf_ui::prelude::*;
|
||||
// use iyes_perf_ui::prelude::*;
|
||||
use shared::animation_plugin::SimpleAnimationPlugin;
|
||||
use shared::sets::GameplaySet;
|
||||
use shared::states::{GameplayState, MenuState};
|
||||
@@ -41,8 +39,6 @@ impl Plugin for PhosGamePlugin {
|
||||
RenderDistancePlugin,
|
||||
BuildingPugin,
|
||||
SimpleAnimationPlugin,
|
||||
LunexSetupPlugin,
|
||||
BuildUiPlugin,
|
||||
UnitsPlugin,
|
||||
DespawnPuglin,
|
||||
TileSelectionPlugin,
|
||||
@@ -63,8 +59,8 @@ impl Plugin for PhosGamePlugin {
|
||||
//Perf UI
|
||||
app.add_plugins(bevy::diagnostic::FrameTimeDiagnosticsPlugin)
|
||||
.add_plugins(bevy::diagnostic::EntityCountDiagnosticsPlugin)
|
||||
.add_plugins(bevy::diagnostic::SystemInformationDiagnosticsPlugin)
|
||||
.add_plugins(PerfUiPlugin);
|
||||
.add_plugins(bevy::diagnostic::SystemInformationDiagnosticsPlugin);
|
||||
// .add_plugins(PerfUiPlugin);
|
||||
|
||||
//Physics
|
||||
app.add_plugins(RapierPhysicsPlugin::<NoUserData>::default());
|
||||
@@ -80,52 +76,51 @@ impl Plugin for PhosGamePlugin {
|
||||
fn configure_gameplay_set(app: &mut App) {
|
||||
app.configure_sets(
|
||||
Update,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
app.configure_sets(
|
||||
PreUpdate,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
app.configure_sets(
|
||||
PostUpdate,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
|
||||
app.configure_sets(
|
||||
FixedUpdate,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
app.configure_sets(
|
||||
FixedPreUpdate,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
app.configure_sets(
|
||||
FixedPostUpdate,
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and_then(in_state(MenuState::InGame))),
|
||||
GameplaySet.run_if(in_state(GeneratorState::Idle).and(in_state(MenuState::InGame))),
|
||||
);
|
||||
}
|
||||
|
||||
fn init_game(mut commands: Commands, mut materials: ResMut<Assets<StandardMaterial>>) {
|
||||
commands.spawn((
|
||||
PerfUiRoot::default(),
|
||||
PerfUiEntryFPS::default(),
|
||||
PerfUiEntryFPSWorst::default(),
|
||||
PerfUiEntryFrameTime::default(),
|
||||
PerfUiEntryFrameTimeWorst::default(),
|
||||
));
|
||||
// commands.spawn((
|
||||
// PerfUiRoot::default(),
|
||||
// PerfUiEntryFPS::default(),
|
||||
// PerfUiEntryFPSWorst::default(),
|
||||
// PerfUiEntryFrameTime::default(),
|
||||
// PerfUiEntryFrameTimeWorst::default(),
|
||||
// ));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfig {
|
||||
CascadeShadowConfig {
|
||||
bounds: vec![200., 400., 600., 800.],
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(500., 260.0, 500.).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(500., 260.0, 500.).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
let sphere_mat = StandardMaterial {
|
||||
base_color: Color::srgb(1., 1., 0.),
|
||||
@@ -148,12 +143,9 @@ fn spawn_sphere(
|
||||
if keyboard_input.just_pressed(KeyCode::KeyF) {
|
||||
let cam_transform = cam.single();
|
||||
commands.spawn((
|
||||
MaterialMeshBundle {
|
||||
mesh: meshes.add(Sphere::new(0.3)),
|
||||
material: mat.0.clone(),
|
||||
transform: Transform::from_translation(cam_transform.translation),
|
||||
..default()
|
||||
},
|
||||
Mesh3d(meshes.add(Sphere::new(0.3))),
|
||||
MeshMaterial3d(mat.0.clone()),
|
||||
Transform::from_translation(cam_transform.translation),
|
||||
Collider::ball(0.3),
|
||||
RigidBody::Dynamic,
|
||||
Ccd::enabled(),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use bevy::asset::{Asset, Handle};
|
||||
use bevy::image::Image;
|
||||
use bevy::pbr::{Material, MaterialExtension};
|
||||
use bevy::reflect::TypePath;
|
||||
use bevy::render::mesh::{MeshVertexAttribute, MeshVertexBufferLayoutRef};
|
||||
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
|
||||
use bevy::render::texture::Image;
|
||||
use world_generation::consts::{ATTRIBUTE_PACKED_VERTEX_DATA, ATTRIBUTE_VERTEX_HEIGHT};
|
||||
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
use bevy::{prelude::*, render::view::RenderLayers, sprite::Anchor};
|
||||
use bevy_lunex::prelude::*;
|
||||
// use bevy::{prelude::*, render::view::RenderLayers, sprite::Anchor};
|
||||
// use bevy_lunex::prelude::*;
|
||||
|
||||
pub struct BuildUiPlugin;
|
||||
// pub struct BuildUiPlugin;
|
||||
|
||||
impl Plugin for BuildUiPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(PostStartup, setup_ui);
|
||||
}
|
||||
}
|
||||
// impl Plugin for BuildUiPlugin {
|
||||
// fn build(&self, app: &mut App) {
|
||||
// app.add_systems(PostStartup, setup_ui);
|
||||
// }
|
||||
// }
|
||||
|
||||
fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResMut<Assets<StandardMaterial>>) {
|
||||
commands
|
||||
.spawn((
|
||||
UiTreeBundle::<MainUi> {
|
||||
tree: UiTree::new2d("BuildUi"),
|
||||
..default()
|
||||
},
|
||||
Name::new("Build UI"),
|
||||
SourceFromCamera,
|
||||
RenderLayers::layer(1),
|
||||
))
|
||||
.with_children(|ui| {
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root"),
|
||||
UiLayout::boundary()
|
||||
.pos1((Rl(0.), Rl(0.)))
|
||||
.pos2((Rl(100.), Rl(100.)))
|
||||
.pack::<Base>(),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
// fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResMut<Assets<StandardMaterial>>) {
|
||||
// commands
|
||||
// .spawn((
|
||||
// UiTreeBundle::<MainUi> {
|
||||
// tree: UiTree::new2d("BuildUi"),
|
||||
// ..default()
|
||||
// },
|
||||
// Name::new("Build UI"),
|
||||
// SourceFromCamera,
|
||||
// RenderLayers::layer(1),
|
||||
// ))
|
||||
// .with_children(|ui| {
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path("Root"),
|
||||
// UiLayout::boundary()
|
||||
// .pos1((Rl(0.), Rl(0.)))
|
||||
// .pos2((Rl(100.), Rl(100.)))
|
||||
// .pack::<Base>(),
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root/MainRect"),
|
||||
UiLayout::window()
|
||||
.anchor(Anchor::BottomCenter)
|
||||
.size((Ab(800.), Rl(100.)))
|
||||
.pos((Rl(50.), Rl(100.)))
|
||||
.pack::<Base>(),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path("Root/MainRect"),
|
||||
// UiLayout::window()
|
||||
// .anchor(Anchor::BottomCenter)
|
||||
// .size((Ab(800.), Rl(100.)))
|
||||
// .pos((Rl(50.), Rl(100.)))
|
||||
// .pack::<Base>(),
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root/MainRect/Categories"),
|
||||
UiLayout::solid()
|
||||
.align_y(Align::END)
|
||||
.size((Rl(100.), Ab(30.)))
|
||||
.pack::<Base>(),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path("Root/MainRect/Categories"),
|
||||
// UiLayout::solid()
|
||||
// .align_y(Align::END)
|
||||
// .size((Rl(100.), Ab(30.)))
|
||||
// .pack::<Base>(),
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
|
||||
for i in 0..5 {
|
||||
let path = format!("Root/MainRect/Categories/Button{}", i);
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path(path),
|
||||
UiLayout::window()
|
||||
.size((Rl(100. / 5.), Ab(30.)))
|
||||
.x(Rl((100. / 5.) * i as f32))
|
||||
.pack::<Base>(),
|
||||
UiLayout::window()
|
||||
.size((Rl(100. / 5.), Ab(20.)))
|
||||
.x(Rl((100. / 5.) * i as f32))
|
||||
.pack::<Hover>(),
|
||||
UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path(format!("{}/img", path)),
|
||||
// UiLayout::solid().size((Ab(30.), Ab(100.))).pack::<Base>(),
|
||||
// UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||
// ));
|
||||
}
|
||||
});
|
||||
}
|
||||
// for i in 0..5 {
|
||||
// let path = format!("Root/MainRect/Categories/Button{}", i);
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path(path),
|
||||
// UiLayout::window()
|
||||
// .size((Rl(100. / 5.), Ab(30.)))
|
||||
// .x(Rl((100. / 5.) * i as f32))
|
||||
// .pack::<Base>(),
|
||||
// UiLayout::window()
|
||||
// .size((Rl(100. / 5.), Ab(20.)))
|
||||
// .x(Rl((100. / 5.) * i as f32))
|
||||
// .pack::<Hover>(),
|
||||
// UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
// // ui.spawn((
|
||||
// // UiLink::<MainUi>::path(format!("{}/img", path)),
|
||||
// // UiLayout::solid().size((Ab(30.), Ab(100.))).pack::<Base>(),
|
||||
// // UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||
// // ));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
use bevy::{
|
||||
prelude::*,
|
||||
render::{
|
||||
render_resource::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages},
|
||||
view::RenderLayers,
|
||||
},
|
||||
window::PrimaryWindow,
|
||||
};
|
||||
use bevy_lunex::prelude::*;
|
||||
use shared::tags::MainCamera;
|
||||
// use bevy::{
|
||||
// prelude::*,
|
||||
// render::{
|
||||
// render_resource::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages},
|
||||
// view::RenderLayers,
|
||||
// },
|
||||
// window::PrimaryWindow,
|
||||
// };
|
||||
// use bevy_lunex::prelude::*;
|
||||
// use shared::tags::MainCamera;
|
||||
|
||||
pub struct LunexSetupPlugin;
|
||||
// pub struct LunexSetupPlugin;
|
||||
|
||||
impl Plugin for LunexSetupPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(UiDefaultPlugins);
|
||||
// impl Plugin for LunexSetupPlugin {
|
||||
// fn build(&self, app: &mut App) {
|
||||
// app.add_plugins(UiDefaultPlugins);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
app.add_plugins(UiDebugPlugin::<MainUi>::new());
|
||||
app.add_systems(PostStartup, setup_cameras);
|
||||
}
|
||||
}
|
||||
// #[cfg(debug_assertions)]
|
||||
// app.add_plugins(UiDebugPlugin::<MainUi>::new());
|
||||
// app.add_systems(PostStartup, setup_cameras);
|
||||
// }
|
||||
// }
|
||||
|
||||
fn setup_cameras(
|
||||
mut commands: Commands,
|
||||
assets: Res<AssetServer>,
|
||||
mut main_3d_camera_q: Query<&mut Camera, With<MainCamera>>,
|
||||
window_query: Query<&Window, With<PrimaryWindow>>,
|
||||
) {
|
||||
//Prepare Render Texture
|
||||
let win = window_query.single();
|
||||
let size = Extent3d {
|
||||
width: win.physical_width(),
|
||||
height: win.physical_height(),
|
||||
..default()
|
||||
};
|
||||
// fn setup_cameras(
|
||||
// mut commands: Commands,
|
||||
// assets: Res<AssetServer>,
|
||||
// mut main_3d_camera_q: Query<&mut Camera, With<MainCamera>>,
|
||||
// window_query: Query<&Window, With<PrimaryWindow>>,
|
||||
// ) {
|
||||
// //Prepare Render Texture
|
||||
// let win = window_query.single();
|
||||
// let size = Extent3d {
|
||||
// width: win.physical_width(),
|
||||
// height: win.physical_height(),
|
||||
// ..default()
|
||||
// };
|
||||
|
||||
let mut image = Image {
|
||||
texture_descriptor: TextureDescriptor {
|
||||
label: None,
|
||||
size,
|
||||
dimension: TextureDimension::D2,
|
||||
format: TextureFormat::Bgra8UnormSrgb,
|
||||
mip_level_count: 1,
|
||||
sample_count: 1,
|
||||
usage: TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_DST | TextureUsages::RENDER_ATTACHMENT,
|
||||
view_formats: &[],
|
||||
},
|
||||
..default()
|
||||
};
|
||||
image.resize(size);
|
||||
// let mut image = Image {
|
||||
// texture_descriptor: TextureDescriptor {
|
||||
// label: None,
|
||||
// size,
|
||||
// dimension: TextureDimension::D2,
|
||||
// format: TextureFormat::Bgra8UnormSrgb,
|
||||
// mip_level_count: 1,
|
||||
// sample_count: 1,
|
||||
// usage: TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_DST | TextureUsages::RENDER_ATTACHMENT,
|
||||
// view_formats: &[],
|
||||
// },
|
||||
// ..default()
|
||||
// };
|
||||
// image.resize(size);
|
||||
|
||||
//Configure 3D Camera
|
||||
let mut cam = main_3d_camera_q.single_mut();
|
||||
let render_image = assets.add(image);
|
||||
cam.target = render_image.clone().into();
|
||||
cam.order = -1;
|
||||
cam.clear_color = ClearColorConfig::Custom(LinearRgba::NONE.into());
|
||||
// //Configure 3D Camera
|
||||
// let mut cam = main_3d_camera_q.single_mut();
|
||||
// let render_image = assets.add(image);
|
||||
// cam.target = render_image.clone().into();
|
||||
// cam.order = -1;
|
||||
// cam.clear_color = ClearColorConfig::Custom(LinearRgba::NONE.into());
|
||||
|
||||
//Add Render Texture image
|
||||
commands
|
||||
.spawn((
|
||||
UiTreeBundle::<MainUi>::from(UiTree::new2d("Main UI")),
|
||||
SourceFromCamera,
|
||||
RenderLayers::layer(1),
|
||||
))
|
||||
.with_children(|ui| {
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root"),
|
||||
UiLayout::window_full().size((Rl(100.), Rl(100.))).pack::<Base>(),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root/Camera3D"),
|
||||
UiLayout::solid()
|
||||
.size((Rl(100.), Rl(100.)))
|
||||
.scaling(Scaling::Fill)
|
||||
.pack::<Base>(),
|
||||
UiImage2dBundle::from(render_image),
|
||||
PickingPortal,
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
});
|
||||
// //Add Render Texture image
|
||||
// commands
|
||||
// .spawn((
|
||||
// UiTreeBundle::<MainUi>::from(UiTree::new2d("Main UI")),
|
||||
// SourceFromCamera,
|
||||
// RenderLayers::layer(1),
|
||||
// ))
|
||||
// .with_children(|ui| {
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path("Root"),
|
||||
// UiLayout::window_full().size((Rl(100.), Rl(100.))).pack::<Base>(),
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
// ui.spawn((
|
||||
// UiLink::<MainUi>::path("Root/Camera3D"),
|
||||
// UiLayout::solid()
|
||||
// .size((Rl(100.), Rl(100.)))
|
||||
// .scaling(Scaling::Fill)
|
||||
// .pack::<Base>(),
|
||||
// UiImage2dBundle::from(render_image),
|
||||
// PickingPortal,
|
||||
// RenderLayers::layer(1),
|
||||
// ));
|
||||
// });
|
||||
|
||||
//Spawn 2d UI Camera
|
||||
commands.spawn((
|
||||
MainUi,
|
||||
Camera2dBundle {
|
||||
transform: Transform::from_xyz(0.0, 0.0, 1000.0),
|
||||
..default()
|
||||
},
|
||||
RenderLayers::from_layers(&[1]),
|
||||
));
|
||||
}
|
||||
// //Spawn 2d UI Camera
|
||||
// commands.spawn((
|
||||
// MainUi,
|
||||
// Camera2dBundle {
|
||||
// transform: Transform::from_xyz(0.0, 0.0, 1000.0),
|
||||
// ..default()
|
||||
// },
|
||||
// RenderLayers::from_layers(&[1]),
|
||||
// ));
|
||||
// }
|
||||
|
||||
@@ -68,12 +68,7 @@ fn regenerate_map(
|
||||
fn show_tile_heights(map: Res<Map>, mut gizmos: Gizmos, shape: Res<Shape>, tile_under_cursor: Res<TileUnderCursor>) {
|
||||
if let Some(contact) = tile_under_cursor.0 {
|
||||
let height = map.sample_height(&contact.tile);
|
||||
gizmos.primitive_3d(
|
||||
&shape.0,
|
||||
contact.tile.to_world(height + 0.01),
|
||||
Quat::IDENTITY,
|
||||
Color::WHITE,
|
||||
);
|
||||
gizmos.primitive_3d(&shape.0, contact.tile.to_world(height + 0.01), Color::WHITE);
|
||||
|
||||
gizmos.line(contact.point, contact.point + Vec3::X, LinearRgba::RED);
|
||||
gizmos.line(contact.point, contact.point + Vec3::Y, LinearRgba::GREEN);
|
||||
@@ -95,11 +90,11 @@ fn show_water_corners(pos: Vec3, gizmos: &mut Gizmos) {
|
||||
fn camera_debug(mut cam_query: Query<(&PhosCamera, &PhosOrbitCamera)>, mut gizmos: Gizmos) {
|
||||
let (config, orbit) = cam_query.single();
|
||||
|
||||
gizmos.sphere(orbit.target, Quat::IDENTITY, 0.3, LinearRgba::RED);
|
||||
gizmos.sphere(orbit.target, 0.3, LinearRgba::RED);
|
||||
let cam_proxy = orbit.target - (orbit.forward * 10.0);
|
||||
gizmos.ray(orbit.target, orbit.forward * 10.0, LinearRgba::rgb(1.0, 0.0, 1.0));
|
||||
|
||||
gizmos.circle(cam_proxy, Dir3::Y, 0.3, LinearRgba::rgb(1.0, 1.0, 0.0));
|
||||
gizmos.circle(cam_proxy, 0.3, LinearRgba::rgb(1.0, 1.0, 0.0));
|
||||
}
|
||||
|
||||
fn verbose_data() {}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_rapier3d::{plugin::RapierContext, prelude::QueryFilter};
|
||||
use bevy_rapier3d::{
|
||||
plugin::{RapierContext, ReadDefaultRapierContext},
|
||||
prelude::QueryFilter,
|
||||
};
|
||||
use shared::{
|
||||
resources::{TileContact, TileUnderCursor},
|
||||
tags::MainCamera,
|
||||
@@ -20,7 +23,7 @@ impl Plugin for TileSelectionPlugin {
|
||||
fn update_tile_under_cursor(
|
||||
cam_query: Query<(&GlobalTransform, &Camera), With<MainCamera>>,
|
||||
window: Query<&Window, With<PrimaryWindow>>,
|
||||
rapier_context: Res<RapierContext>,
|
||||
rapier_context: ReadDefaultRapierContext,
|
||||
map: Res<Map>,
|
||||
mut tile_under_cursor: ResMut<TileUnderCursor>,
|
||||
) {
|
||||
@@ -35,7 +38,7 @@ fn update_tile_under_cursor(
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(cam_ray) = camera.viewport_to_world(cam_transform, cursor_pos) else {
|
||||
let Ok(cam_ray) = camera.viewport_to_world(cam_transform, cursor_pos) else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
shared = { path = "../shared" }
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
asset_loader = { path = "../../engine/asset_loader" }
|
||||
serde_json = "1.0.120"
|
||||
ron = "0.8.1"
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ impl Plugin for SimpleAnimationPlugin {
|
||||
fn rotate(mut query: Query<(&mut Transform, &RotationAnimation)>, time: Res<Time>) {
|
||||
for (mut transform, rot) in query.iter_mut() {
|
||||
let cur_rot = transform.rotation;
|
||||
transform.rotation = cur_rot * Quat::from_axis_angle(rot.axis, rot.speed.to_radians() * time.delta_seconds());
|
||||
transform.rotation = cur_rot * Quat::from_axis_angle(rot.axis, rot.speed.to_radians() * time.delta_secs());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ impl Plugin for DespawnPuglin {
|
||||
|
||||
fn despawn_at(mut commands: Commands, time: Res<Time>, entities: Query<(Entity, &DespawnAt), Without<DespawnAfter>>) {
|
||||
for (entity, at) in entities.iter() {
|
||||
let d = at.0 - time.elapsed_seconds();
|
||||
let d = at.0 - time.elapsed_secs();
|
||||
commands
|
||||
.entity(entity)
|
||||
.insert(DespawnAfter(Timer::from_seconds(d, TimerMode::Once)));
|
||||
|
||||
@@ -19,17 +19,16 @@ impl PrefabDefination {
|
||||
let mesh_handle = &gltf.named_meshes[&self.path.clone().into_boxed_str()];
|
||||
if let Some(gltf_mesh) = meshes.get(mesh_handle.id()) {
|
||||
let (m, mat) = gltf_mesh.unpack();
|
||||
let mut entity = commands.spawn(PbrBundle {
|
||||
mesh: m,
|
||||
material: mat,
|
||||
transform: Transform::from_translation(self.pos).with_rotation(Quat::from_euler(
|
||||
let mut entity = commands.spawn((
|
||||
Mesh3d(m),
|
||||
MeshMaterial3d(mat),
|
||||
Transform::from_translation(self.pos).with_rotation(Quat::from_euler(
|
||||
bevy::math::EulerRot::XYZ,
|
||||
self.rot.x,
|
||||
self.rot.y,
|
||||
self.rot.z,
|
||||
)),
|
||||
..Default::default()
|
||||
});
|
||||
));
|
||||
if let Some(children) = &self.children {
|
||||
entity.with_children(|b| {
|
||||
for child in children {
|
||||
|
||||
@@ -4,15 +4,15 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
shared = { path = "../shared" }
|
||||
bevy_rapier3d = "0.27.0"
|
||||
bevy_rapier3d = "0.28.0"
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
asset_loader = { path = "../../engine/asset_loader" }
|
||||
serde_json = "1.0.120"
|
||||
ron = "0.8.1"
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
|
||||
@@ -34,11 +34,7 @@ fn spawn_test_unit(
|
||||
if let Some(contact) = tile_under_cursor.0 {
|
||||
info!("Spawning Test Unit");
|
||||
commands.spawn((
|
||||
PbrBundle {
|
||||
transform: Transform::from_translation(contact.surface),
|
||||
mesh: unit.0.clone(),
|
||||
..default()
|
||||
},
|
||||
(Transform::from_translation(contact.surface), Mesh3d(unit.0.clone())),
|
||||
Unit,
|
||||
LandUnit,
|
||||
));
|
||||
|
||||
@@ -71,7 +71,7 @@ fn move_unit(
|
||||
path.1 += 1;
|
||||
continue;
|
||||
}
|
||||
let vel = d.normalize() * 10.0 * time.delta_seconds();
|
||||
let vel = d.normalize() * 10.0 * time.delta_secs();
|
||||
t.translation += vel;
|
||||
let coord = HexCoord::from_world_pos(t.translation);
|
||||
if map.is_in_bounds(&coord) {
|
||||
|
||||
Reference in New Issue
Block a user