Update to Bevy 0.8.

This commit is contained in:
Nolan Darilek 2022-08-01 11:38:15 -05:00
parent da413ef4e4
commit 2ff8a858ed
4 changed files with 23 additions and 21 deletions

View File

@ -11,7 +11,7 @@ edition = "2021"
speech_dispatcher_0_10 = ["bevy_tts/speech_dispatcher_0_10"]
[dependencies.bevy]
version = "0.7"
version = "0.8"
default-features = false
features = [
"bevy_gilrs",
@ -24,13 +24,13 @@ features = [
[dependencies]
backtrace = "0.3"
bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap" }
bevy_rapier2d = { version = "0.15", features = ["serde-serialize"] }
bevy_synthizer = { git = "https://labs.lightsout.games/projects/bevy_synthizer" }
bevy_tts = { git = "https://github.com/lightsoutgames/bevy_tts", default-features = false, features = ["tolk"] }
bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap", branch = "bevy-0.8" }
bevy_rapier2d = { version = "0.16", features = ["serde-serialize"] }
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"], branch = "bevy-0.8" }
coord_2d = "0.3"
futures-lite = "1"
gilrs = "0.8"
gilrs = "0.9"
here_be_dragons = "0.1"
maze_generator = "2"
once_cell = "1"

View File

@ -7,7 +7,7 @@ use std::{
sync::RwLock,
};
use bevy::{core::FloatOrd, ecs::query::WorldQuery, prelude::*};
use bevy::{ecs::query::WorldQuery, prelude::*, utils::FloatOrd};
use bevy_rapier2d::{
na,
parry::query::ClosestPoints,
@ -391,11 +391,11 @@ impl PointLike for &Transform {
impl PointLike for GlobalTransform {
fn x(&self) -> f32 {
self.translation.x
self.translation().x
}
fn y(&self) -> f32 {
self.translation.y
self.translation().y
}
}
@ -482,7 +482,7 @@ pub trait GlobalTransformExt {
impl GlobalTransformExt for GlobalTransform {
fn yaw(&self) -> Angle {
let forward = self.local_x();
let forward = self.forward();
Angle::Radians(forward.y.atan2(forward.x))
}
@ -494,13 +494,15 @@ impl GlobalTransformExt for GlobalTransform {
) -> String {
use bevy::math::Vec3Swizzles;
let scale = PHYSICS_SCALE.read().unwrap();
let (_, rotation, _) = self.to_scale_rotation_translation();
let pos1 = Isometry::new(
(self.translation / *scale).xy().into(),
self.rotation.to_scaled_axis().z,
(self.translation() / *scale).xy().into(),
rotation.to_scaled_axis().z,
);
let (_, other_rotation, _) = self.to_scale_rotation_translation();
let pos2 = Isometry::new(
(other.translation / *scale).xy().into(),
other.rotation.to_scaled_axis().z,
(other.translation() / *scale).xy().into(),
other_rotation.to_scaled_axis().z,
);
let closest = bevy_rapier2d::parry::query::closest_points(
&pos1,

View File

@ -35,12 +35,12 @@ fn tag_behind(
) {
if config.downshift_behind {
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() {
if icon.is_none() && sound.is_none() {
continue;
}
let v = transform.translation - listener_transform.translation;
let v = transform.translation() - listener_transform.translation();
let dot = v.dot(listener_forward);
let is_behind = dot <= 0.;
if is_behind {

View File

@ -63,14 +63,14 @@ impl Viewshed {
let mut boxes = vec![];
let shape = Collider::cuboid(self.range as f32, self.range as f32);
rapier_context.intersections_with_shape(
start.translation.truncate(),
start.translation().truncate(),
0.,
&shape,
QueryFilter::new().predicate(&|e| visible_query.get(e).is_ok()),
|entity| {
if let Ok((_, collider, transform)) = visible_query.get(entity) {
let position = Isometry2::new(
Vector2::new(transform.translation.x, transform.translation.y),
Vector2::new(transform.translation().x, transform.translation().y),
0.,
);
// println!(
@ -88,8 +88,8 @@ impl Viewshed {
let shape = Collider::cuboid(0.5, 0.5);
let mut new_visible_entities = HashSet::new();
let size = (
(start.translation.x.abs() + self.range as f32) as u32,
(start.translation.y.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,
);
let visibility_grid = VisibilityGrid(
size,
@ -410,7 +410,7 @@ fn log_visible(
{
viewer_transform.collider_direction_and_distance(
viewer_collider,
&viewed_transform,
viewed_transform,
viewed_collider,
)
} else {