Update to Bevy 0.8.
This commit is contained in:
parent
da413ef4e4
commit
2ff8a858ed
12
Cargo.toml
12
Cargo.toml
|
@ -11,7 +11,7 @@ edition = "2021"
|
||||||
speech_dispatcher_0_10 = ["bevy_tts/speech_dispatcher_0_10"]
|
speech_dispatcher_0_10 = ["bevy_tts/speech_dispatcher_0_10"]
|
||||||
|
|
||||||
[dependencies.bevy]
|
[dependencies.bevy]
|
||||||
version = "0.7"
|
version = "0.8"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"bevy_gilrs",
|
"bevy_gilrs",
|
||||||
|
@ -24,13 +24,13 @@ features = [
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap" }
|
bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap", branch = "bevy-0.8" }
|
||||||
bevy_rapier2d = { version = "0.15", features = ["serde-serialize"] }
|
bevy_rapier2d = { version = "0.16", features = ["serde-serialize"] }
|
||||||
bevy_synthizer = { git = "https://labs.lightsout.games/projects/bevy_synthizer" }
|
bevy_synthizer = { git = "https://labs.lightsout.games/projects/bevy_synthizer", branch = "bevy-0.8" }
|
||||||
bevy_tts = { git = "https://github.com/lightsoutgames/bevy_tts", default-features = false, features = ["tolk"] }
|
bevy_tts = { git = "https://github.com/lightsoutgames/bevy_tts", default-features = false, features = ["tolk"], branch = "bevy-0.8" }
|
||||||
coord_2d = "0.3"
|
coord_2d = "0.3"
|
||||||
futures-lite = "1"
|
futures-lite = "1"
|
||||||
gilrs = "0.8"
|
gilrs = "0.9"
|
||||||
here_be_dragons = "0.1"
|
here_be_dragons = "0.1"
|
||||||
maze_generator = "2"
|
maze_generator = "2"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
|
|
18
src/core.rs
18
src/core.rs
|
@ -7,7 +7,7 @@ use std::{
|
||||||
sync::RwLock,
|
sync::RwLock,
|
||||||
};
|
};
|
||||||
|
|
||||||
use bevy::{core::FloatOrd, ecs::query::WorldQuery, prelude::*};
|
use bevy::{ecs::query::WorldQuery, prelude::*, utils::FloatOrd};
|
||||||
use bevy_rapier2d::{
|
use bevy_rapier2d::{
|
||||||
na,
|
na,
|
||||||
parry::query::ClosestPoints,
|
parry::query::ClosestPoints,
|
||||||
|
@ -391,11 +391,11 @@ impl PointLike for &Transform {
|
||||||
|
|
||||||
impl PointLike for GlobalTransform {
|
impl PointLike for GlobalTransform {
|
||||||
fn x(&self) -> f32 {
|
fn x(&self) -> f32 {
|
||||||
self.translation.x
|
self.translation().x
|
||||||
}
|
}
|
||||||
|
|
||||||
fn y(&self) -> f32 {
|
fn y(&self) -> f32 {
|
||||||
self.translation.y
|
self.translation().y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ pub trait GlobalTransformExt {
|
||||||
|
|
||||||
impl GlobalTransformExt for GlobalTransform {
|
impl GlobalTransformExt for GlobalTransform {
|
||||||
fn yaw(&self) -> Angle {
|
fn yaw(&self) -> Angle {
|
||||||
let forward = self.local_x();
|
let forward = self.forward();
|
||||||
Angle::Radians(forward.y.atan2(forward.x))
|
Angle::Radians(forward.y.atan2(forward.x))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,13 +494,15 @@ impl GlobalTransformExt for GlobalTransform {
|
||||||
) -> String {
|
) -> String {
|
||||||
use bevy::math::Vec3Swizzles;
|
use bevy::math::Vec3Swizzles;
|
||||||
let scale = PHYSICS_SCALE.read().unwrap();
|
let scale = PHYSICS_SCALE.read().unwrap();
|
||||||
|
let (_, rotation, _) = self.to_scale_rotation_translation();
|
||||||
let pos1 = Isometry::new(
|
let pos1 = Isometry::new(
|
||||||
(self.translation / *scale).xy().into(),
|
(self.translation() / *scale).xy().into(),
|
||||||
self.rotation.to_scaled_axis().z,
|
rotation.to_scaled_axis().z,
|
||||||
);
|
);
|
||||||
|
let (_, other_rotation, _) = self.to_scale_rotation_translation();
|
||||||
let pos2 = Isometry::new(
|
let pos2 = Isometry::new(
|
||||||
(other.translation / *scale).xy().into(),
|
(other.translation() / *scale).xy().into(),
|
||||||
other.rotation.to_scaled_axis().z,
|
other_rotation.to_scaled_axis().z,
|
||||||
);
|
);
|
||||||
let closest = bevy_rapier2d::parry::query::closest_points(
|
let closest = bevy_rapier2d::parry::query::closest_points(
|
||||||
&pos1,
|
&pos1,
|
||||||
|
|
|
@ -35,12 +35,12 @@ fn tag_behind(
|
||||||
) {
|
) {
|
||||||
if config.downshift_behind {
|
if config.downshift_behind {
|
||||||
if let Ok(listener_transform) = listener.get_single() {
|
if let Ok(listener_transform) = listener.get_single() {
|
||||||
let listener_forward = listener_transform.local_x();
|
let listener_forward = listener_transform.forward();
|
||||||
for (entity, transform, sound, icon) in sounds.iter() {
|
for (entity, transform, sound, icon) in sounds.iter() {
|
||||||
if icon.is_none() && sound.is_none() {
|
if icon.is_none() && sound.is_none() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let v = transform.translation - listener_transform.translation;
|
let v = transform.translation() - listener_transform.translation();
|
||||||
let dot = v.dot(listener_forward);
|
let dot = v.dot(listener_forward);
|
||||||
let is_behind = dot <= 0.;
|
let is_behind = dot <= 0.;
|
||||||
if is_behind {
|
if is_behind {
|
||||||
|
|
|
@ -63,14 +63,14 @@ impl Viewshed {
|
||||||
let mut boxes = vec![];
|
let mut boxes = vec![];
|
||||||
let shape = Collider::cuboid(self.range as f32, self.range as f32);
|
let shape = Collider::cuboid(self.range as f32, self.range as f32);
|
||||||
rapier_context.intersections_with_shape(
|
rapier_context.intersections_with_shape(
|
||||||
start.translation.truncate(),
|
start.translation().truncate(),
|
||||||
0.,
|
0.,
|
||||||
&shape,
|
&shape,
|
||||||
QueryFilter::new().predicate(&|e| visible_query.get(e).is_ok()),
|
QueryFilter::new().predicate(&|e| visible_query.get(e).is_ok()),
|
||||||
|entity| {
|
|entity| {
|
||||||
if let Ok((_, collider, transform)) = visible_query.get(entity) {
|
if let Ok((_, collider, transform)) = visible_query.get(entity) {
|
||||||
let position = Isometry2::new(
|
let position = Isometry2::new(
|
||||||
Vector2::new(transform.translation.x, transform.translation.y),
|
Vector2::new(transform.translation().x, transform.translation().y),
|
||||||
0.,
|
0.,
|
||||||
);
|
);
|
||||||
// println!(
|
// println!(
|
||||||
|
@ -88,8 +88,8 @@ impl Viewshed {
|
||||||
let shape = Collider::cuboid(0.5, 0.5);
|
let shape = Collider::cuboid(0.5, 0.5);
|
||||||
let mut new_visible_entities = HashSet::new();
|
let mut new_visible_entities = HashSet::new();
|
||||||
let size = (
|
let size = (
|
||||||
(start.translation.x.abs() + self.range as f32) as u32,
|
(start.translation().x.abs() + self.range as f32) as u32,
|
||||||
(start.translation.y.abs() + self.range as f32) as u32,
|
(start.translation().y.abs() + self.range as f32) as u32,
|
||||||
);
|
);
|
||||||
let visibility_grid = VisibilityGrid(
|
let visibility_grid = VisibilityGrid(
|
||||||
size,
|
size,
|
||||||
|
@ -410,7 +410,7 @@ fn log_visible(
|
||||||
{
|
{
|
||||||
viewer_transform.collider_direction_and_distance(
|
viewer_transform.collider_direction_and_distance(
|
||||||
viewer_collider,
|
viewer_collider,
|
||||||
&viewed_transform,
|
viewed_transform,
|
||||||
viewed_collider,
|
viewed_collider,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user