Skip to content

Commit

Permalink
Release v0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Mar 9, 2024
1 parent 85e8e80 commit 4c91470
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ debug = true

[package]
name = "wlx-overlay-s"
version = "0.2.5"
version = "0.2.6"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
22 changes: 20 additions & 2 deletions src/backend/openvr/playspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use glam::{Affine3A, Vec3A};
use ovr_overlay::{
chaperone_setup::ChaperoneSetupManager,
compositor::CompositorManager,
sys::{EChaperoneConfigFile, ETrackingUniverseOrigin, HmdMatrix34_t},
sys::{EChaperoneConfigFile, ETrackingUniverseOrigin, HmdMatrix34_t, HmdVector3_t},
};

use crate::{
Expand Down Expand Up @@ -56,12 +56,16 @@ impl PlayspaceMover {
return;
}

let overlay_offset = data.pose.inverse().transform_vector3a(relative_pos);

overlays.iter_mut().for_each(|overlay| {
if overlay.state.grabbable {
overlay.state.dirty = true;
overlay.state.transform.translation -= relative_pos;
overlay.state.transform.translation -= overlay_offset;
}
});
chaperone_mgr.revert_working_copy();
apply_chaperone_offset(overlay_offset, chaperone_mgr);

data.pose.translation += relative_pos;
data.hand_pos = new_hand;
Expand Down Expand Up @@ -171,3 +175,17 @@ fn set_working_copy(
_ => chaperone_mgr.set_working_seated_zero_pose_to_raw_tracking_pose(&mat),
};
}

fn apply_chaperone_offset(offset: Vec3A, chaperone_mgr: &mut ChaperoneSetupManager) {
let mut quads = chaperone_mgr.get_working_collision_bounds_info();
quads.iter_mut().for_each(|quad| {
quad.vCorners.iter_mut().for_each(|corner| {
corner.v[0] += offset.x;
if corner.v[1] != 0.0 {
corner.v[1] += offset.y;
}
corner.v[2] += offset.z;
});
});
chaperone_mgr.set_working_collision_bounds_info(&mut quads);
}

0 comments on commit 4c91470

Please sign in to comment.