update with main branch
This commit is contained in:
@@ -21,7 +21,7 @@ bevy_asset_loader = { version = "0.21.0", features = [
|
||||
"3d",
|
||||
] }
|
||||
ron = "0.8.1"
|
||||
avian3d = { version = "0.1.1" }
|
||||
avian3d = { version = "0.1.2" }
|
||||
image = "0.25.2"
|
||||
|
||||
[features]
|
||||
|
||||
Submodule game/main/assets updated: 3bb0aaab5b...d9e7ec8297
@@ -3,8 +3,6 @@ use bevy::ecs::world::CommandQueue;
|
||||
use bevy::prelude::*;
|
||||
use bevy::tasks::*;
|
||||
use bevy::utils::futures;
|
||||
use bevy_rapier3d::geometry::Collider;
|
||||
use bevy_rapier3d::geometry::TriMeshFlags;
|
||||
use shared::events::ChunkModifiedEvent;
|
||||
use shared::events::TileModifiedEvent;
|
||||
use world_generation::prelude::Map;
|
||||
|
||||
@@ -4,14 +4,12 @@ use crate::utlis::editor_plugin::EditorPlugin;
|
||||
use crate::utlis::render_distance_system::RenderDistancePlugin;
|
||||
use crate::utlis::tile_selection_plugin::TileSelectionPlugin;
|
||||
use crate::{camera_system::camera_plugin::PhosCameraPlugin, utlis::debug_plugin::DebugPlugin};
|
||||
use avian3d::{math::*, prelude::*};
|
||||
use bevy::{
|
||||
pbr::{wireframe::WireframeConfig, CascadeShadowConfig},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy_asset_loader::prelude::*;
|
||||
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 shared::sets::GameplaySet;
|
||||
@@ -61,7 +59,7 @@ impl Plugin for PhosGamePlugin {
|
||||
.add_plugins(PerfUiPlugin);
|
||||
|
||||
//Physics
|
||||
app.add_plugins(RapierPhysicsPlugin::<NoUserData>::default());
|
||||
app.add_plugins(PhysicsPlugins::default());
|
||||
// app.add_plugins(RapierDebugRenderPlugin::default());
|
||||
|
||||
app.insert_resource(WireframeConfig {
|
||||
@@ -148,10 +146,9 @@ fn spawn_sphere(
|
||||
transform: Transform::from_translation(cam_transform.translation),
|
||||
..default()
|
||||
},
|
||||
Collider::ball(0.3),
|
||||
Collider::sphere(0.3),
|
||||
RigidBody::Dynamic,
|
||||
Ccd::enabled(),
|
||||
Velocity::linear(cam_transform.forward() * 50.),
|
||||
LinearVelocity(cam_transform.forward() * 50.),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_inspector_egui::bevy_egui::{systems::InputEvents, EguiContexts};
|
||||
use bevy_inspector_egui::egui;
|
||||
use bevy_rapier3d::prelude::*;
|
||||
use shared::resources::TileUnderCursor;
|
||||
use shared::states::GameplayState;
|
||||
use shared::tags::MainCamera;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use avian3d::prelude::{SpatialQuery, SpatialQueryFilter};
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_rapier3d::{plugin::RapierContext, prelude::QueryFilter};
|
||||
use shared::{
|
||||
resources::{TileContact, TileUnderCursor},
|
||||
tags::MainCamera,
|
||||
@@ -20,7 +20,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>,
|
||||
spatial_query: SpatialQuery,
|
||||
map: Res<Map>,
|
||||
mut tile_under_cursor: ResMut<TileUnderCursor>,
|
||||
) {
|
||||
@@ -34,15 +34,16 @@ fn update_tile_under_cursor(
|
||||
return;
|
||||
};
|
||||
|
||||
let collision = rapier_context.cast_ray(
|
||||
let collision = spatial_query.cast_ray(
|
||||
cam_ray.origin,
|
||||
cam_ray.direction.into(),
|
||||
500.,
|
||||
true,
|
||||
QueryFilter::only_fixed(),
|
||||
SpatialQueryFilter::default(),
|
||||
);
|
||||
|
||||
if let Some((_e, dist)) = collision {
|
||||
if let Some(data) = collision {
|
||||
let dist = data.time_of_impact;
|
||||
let contact_point = cam_ray.get_point(dist);
|
||||
let contact_coord = HexCoord::from_world_pos(contact_point);
|
||||
//todo: handle correct tile detection when contacting a tile from the side
|
||||
|
||||
Reference in New Issue
Block a user