Fixed CI and incorrect vel

This commit is contained in:
Joshua Barretto 2023-10-21 14:58:13 +01:00
parent 4adfb95c9b
commit 22b537a4e5
3 changed files with 19 additions and 12 deletions

View File

@ -906,7 +906,7 @@ impl<'a> PhysicsData<'a> {
}, },
read, read,
&ori, &ori,
|vel| friction_factor(vel), friction_factor,
); );
tgt_pos = cpos.0; tgt_pos = cpos.0;
}, },
@ -941,7 +941,7 @@ impl<'a> PhysicsData<'a> {
}, },
read, read,
&ori, &ori,
|vel| friction_factor(vel), friction_factor,
); );
// Sticky things shouldn't move when on a surface // Sticky things shouldn't move when on a surface
@ -1228,7 +1228,7 @@ impl<'a> PhysicsData<'a> {
}, },
read, read,
&ori, &ori,
|vel| friction_factor(vel), |vel| friction_factor(previous_cache_other.ori * vel),
); );
// Transform entity attributes back into world space now // Transform entity attributes back into world space now

View File

@ -7,7 +7,7 @@ use common::{
util::Dir, util::Dir,
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use specs::{Entities, Join, Read, ReadStorage, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadStorage, WriteStorage};
use vek::*; use vek::*;
/// This system is responsible for controlling mounts /// This system is responsible for controlling mounts
@ -49,17 +49,22 @@ impl<'a> System<'a> for Sys {
for (follower, is_follower, follower_body, follower_scale) in for (follower, is_follower, follower_body, follower_scale) in
(&entities, &is_followers, bodies.maybe(), scales.maybe()).join() (&entities, &is_followers, bodies.maybe(), scales.maybe()).join()
{ {
let Some(leader) = id_maps.uid_entity(is_follower.leader) else { continue }; let Some(leader) = id_maps.uid_entity(is_follower.leader) else {
continue;
};
let (Some(leader_pos), Some(follower_pos)) = ( let (Some(leader_pos), Some(follower_pos)) = (
positions.get(leader).copied(), positions.get(leader).copied(),
positions.get(follower).copied(), positions.get(follower).copied(),
) else { continue }; ) else {
continue;
};
let (Some(leader_mass), Some(follower_mass)) = ( let (Some(leader_mass), Some(follower_mass)) =
masses.get(leader).copied(), (masses.get(leader).copied(), masses.get(follower).copied())
masses.get(follower).copied(), else {
) else { continue }; continue;
};
if velocities.contains(follower) && velocities.contains(leader) { if velocities.contains(follower) && velocities.contains(leader) {
let attach_offset = orientations let attach_offset = orientations

View File

@ -10,7 +10,7 @@ use common::{
uid::{IdMaps, Uid}, uid::{IdMaps, Uid},
}; };
use hashbrown::HashMap; use hashbrown::HashMap;
use specs::{Join, WorldExt}; use specs::{Join, LendJoin, WorldExt};
use vek::*; use vek::*;
pub struct TetherMgr { pub struct TetherMgr {
@ -53,7 +53,9 @@ impl TetherMgr {
for (interp, is_follower, body, scale) in for (interp, is_follower, body, scale) in
(&interpolated, &is_followers, bodies.maybe(), scales.maybe()).join() (&interpolated, &is_followers, bodies.maybe(), scales.maybe()).join()
{ {
let Some(leader) = id_maps.uid_entity(is_follower.leader) else { continue }; let Some(leader) = id_maps.uid_entity(is_follower.leader) else {
continue;
};
let pos_a = interpolated.get(leader).map_or(Vec3::zero(), |i| i.pos) let pos_a = interpolated.get(leader).map_or(Vec3::zero(), |i| i.pos)
+ interpolated.get(leader).zip(bodies.get(leader)).map_or( + interpolated.get(leader).zip(bodies.get(leader)).map_or(
Vec3::zero(), Vec3::zero(),