Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Bevy 0.14 #24

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ readme = "README.md"
exclude = ["assets/"]

[dependencies]
bevy = { version = "0.13", default-features = false, features = ["bevy_render"] }
bevy_mod_raycast = { version = "0.17" }
bevy = { version = "0.14", default-features = false, features = ["bevy_render"] }
bevy_mod_raycast = { version = "0.18" }

[dev-dependencies]
bevy = { version = "0.13" }
bevy = { version = "0.14" }
4 changes: 2 additions & 2 deletions examples/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(80.0, 80.0)),
material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
material: materials.add(Color::srgb(0.3, 0.5, 0.3)),
..default()
},
// Add `Ground` component to any entity you want the camera to treat as ground.
Ground,
));
// Some "terrain"
let terrain_material = materials.add(Color::rgb(0.8, 0.7, 0.6));
let terrain_material = materials.add(Color::srgb(0.8, 0.7, 0.6));
commands.spawn((
PbrBundle {
mesh: meshes.add(Cuboid::new(15.0, 1.0, 5.0)),
Expand Down
4 changes: 2 additions & 2 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(80.0, 80.0)),
material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
material: materials.add(Color::srgb(0.3, 0.5, 0.3)),
..default()
},
// Add `Ground` component to any entity you want the camera to treat as ground.
Ground,
));
// Some "terrain"
let terrain_material = materials.add(Color::rgb(0.8, 0.7, 0.6));
let terrain_material = materials.add(Color::srgb(0.8, 0.7, 0.6));
commands.spawn((
PbrBundle {
mesh: meshes.add(Cuboid::new(15.0, 1.0, 5.0)),
Expand Down
4 changes: 2 additions & 2 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use bevy::input::ButtonInput;
use bevy::prelude::*;
use bevy::window::{CursorGrabMode, PrimaryWindow};
use bevy_mod_raycast::immediate::{Raycast, RaycastSettings};
use bevy_mod_raycast::{CursorRay, DefaultRaycastingPlugin};
use bevy_mod_raycast::prelude::{CursorRay, CursorRayPlugin};
use std::f32::consts::PI;

pub struct RtsCameraControlsPlugin;

impl Plugin for RtsCameraControlsPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(DefaultRaycastingPlugin).add_systems(
app.add_plugins(CursorRayPlugin).add_systems(
Update,
(zoom, pan, grab_pan, rotate).before(RtsCameraSystemSet),
);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn follow_ground(
cam.target_focus.translation.y + cam.height_max,
cam.target_focus.translation.z,
);
if let Some(hit1) = cast_ray(&mut raycast, ray_start, Direction3d::NEG_Y, &|entity| {
if let Some(hit1) = cast_ray(&mut raycast, ray_start, Dir3::NEG_Y, &|entity| {
ground_q.get(entity).is_ok()
}) {
cam.target_focus.translation.y = hit1.position().y;
Expand Down Expand Up @@ -282,7 +282,7 @@ fn update_camera_transform(mut cam_q: Query<(&mut Transform, &RtsCamera)>) {
fn cast_ray<'a>(
raycast: &'a mut Raycast<'_, '_>,
origin: Vec3,
dir: Direction3d,
dir: Dir3,
filter: &'a dyn Fn(Entity) -> bool,
) -> Option<&'a IntersectionData> {
let ray1 = Ray3d::new(origin, Vec3::from(dir));
Expand Down
Loading