wayvr: fix gravity floor level while being space rotated, dash-frontend: "Reset playspace drag" button (#713)

This commit is contained in:
oo8dev authored and GitHub committed 2026-11-02 22:53:14 +01:00
1 parent ef7e5f61eb
commit e64d531a9c
15 files changed
+74 -52

No files matched your search

+13 -10
View File
@@ -16,6 +16,13 @@
</context_menu>
</blueprint>
<!-- id, tooltip, src_builtin -->
<template name="BottomButton">
<Button color="background(transparent)" border_color="background(transparent)" tooltip_side="top" id="${id}" tooltip="${tooltip}">
<sprite src_builtin="${src_builtin}" width="24" height="24" margin="8" />
</Button>
</template>
<template name="SideButton">
<Button
id="${id}"
@@ -145,16 +152,12 @@
</div>
<!-- Left bottom side -->
<div margin_left="8">
<Button id="btn_power" color="background(transparent)" border_color="background(transparent)" tooltip="POWER_OPTIONS.TITLE" tooltip_side="top">
<sprite src_builtin="@/dashboard/power.svg" width="24" height="24" margin="8" />
</Button>
<Button id="btn_audio" color="background(transparent)" border_color="background(transparent)" tooltip="AUDIO.VOLUME" tooltip_side="top">
<sprite src_builtin="@/dashboard/volume.svg" width="24" height="24" margin="8" />
</Button>
<Button id="btn_recenter" color="background(transparent)" border_color="background(transparent)" tooltip="ACTIONS.RECENTER_PLAYSPACE" tooltip_side="top">
<sprite src_builtin="@/dashboard/recenter.svg" width="24" height="24" margin="8" />
</Button>
<div margin_left="8" align_items="center">
<BottomButton id="btn_power" tooltip="POWER_OPTIONS.TITLE" src_builtin="@/dashboard/power.svg"/>
<rectangle width="2" height="70%" color="outline" margin_left="4" margin_right="4"/>
<BottomButton id="btn_audio" tooltip="AUDIO.VOLUME" src_builtin="@/dashboard/volume.svg"/>
<BottomButton id="btn_recenter" tooltip="ACTIONS.RECENTER_PLAYSPACE" src_builtin="@/dashboard/recenter.svg"/>
<BottomButton id="btn_reset_space_drag" tooltip="RESET_SPACE_DRAG" src_builtin="@/dashboard/drag.svg"/>
</div>
<!-- Right bottom side -->
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "Bist du sicher, dass du den Computer in den Ruhezustand versetzen willst?"
},
"YES": "Ja",
"NO": "Nein"
"NO": "Nein",
"RESET_SPACE_DRAG": "Playspace-Drag zurücksetzen"
}
+1
View File
@@ -348,6 +348,7 @@ PROCESS.FORCE_KILL,Force-kill,Tooltip on the kill button in the running games li
PROCESS.STOP,Stop,Tooltip on the stop button in the running games list.
PROCESS_LIST,Process list,Tab name and group box title in the Monado runtime process list section.
REFRESH,Refresh,Tooltip on the refresh button in the running games list.
RESET_SPACE_DRAG,Reset playspace drag,"Button which resets the user's playspace origin. ""Playspace"" was previously translated as ""${DEFINITIONS.PLAYSPACE}""."
REMOVE,Remove,Button label in the skymap already downloaded dialog and Whisper cleanup dialog to remove files.
APPLY,Apply,Button label in the skymap already downloaded dialog to apply the selected skymap.
RELOAD_FROM_DISK,Reload from disk,Tooltip on the reload button in the skymap list view.
Can't render this file because it contains an unexpected character in line 351 and column 161.
+1
View File
@@ -362,6 +362,7 @@
},
"PROCESS_LIST": "Process list",
"REFRESH": "Refresh",
"RESET_SPACE_DRAG": "Reset playspace drag",
"REMOVE": "Remove",
"APPLY": "Apply",
"RELOAD_FROM_DISK": "Reload from disk",
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "¿Estás seguro de que quieres suspender el equipo?"
},
"YES": "Sí",
"NO": "No"
"NO": "No",
"RESET_SPACE_DRAG": "Restablecer arrastre del espacio de juego"
}
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "Sei sicuro di voler mettere il computer in sospensione?"
},
"YES": "Sì",
"NO": "No"
"NO": "No",
"RESET_SPACE_DRAG": "Reset trascinamento playspace"
}
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "コンピューターをスリープ状態にしますか?"
},
"YES": "はい",
"NO": "いいえ"
"NO": "いいえ",
"RESET_SPACE_DRAG": "プレイスペースのドラッグをリセット"
}
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "Czy na pewno chcesz uśpić komputer?"
},
"YES": "Tak",
"NO": "Nie"
"NO": "Nie",
"RESET_SPACE_DRAG": "Resetuj przesunięcie przestrzeni gry"
}
+2 -1
View File
@@ -380,5 +380,6 @@
"INSTALLED": "Installerad",
"NOT_INSTALLED": "Ej installerad",
"YES": "Ja",
"NO": "Nej"
"NO": "Nej",
"RESET_SPACE_DRAG": "Återställ playspace-drag"
}
+2 -1
View File
@@ -380,5 +380,6 @@
"SUSPEND_ARE_YOU_SURE": "确定要让计算机进入睡眠状态吗?"
},
"YES": "确定",
"NO": "否"
"NO": "否",
"RESET_SPACE_DRAG": "重置活动空间拖拽"
}
+13
View File
@@ -125,6 +125,7 @@ pub enum FrontendTask {
ShowPowerSettings(WidgetID /* source widget */),
UpdateAudioSettingsView,
RecenterPlayspace,
ResetSpaceDrag,
PushToast(Translation),
PlaySound(SoundType),
OpenURL(Rc<str>),
@@ -441,6 +442,7 @@ impl<T: 'static> Frontend<T> {
FrontendTask::ShowPowerSettings(pos) => self.action_show_power_settings(pos)?,
FrontendTask::UpdateAudioSettingsView => self.action_update_audio_settings()?,
FrontendTask::RecenterPlayspace => self.action_recenter_playspace(params.data)?,
FrontendTask::ResetSpaceDrag => self.action_reset_space_drag(params.data)?,
FrontendTask::PushToast(content) => self.toast_manager.push(content),
FrontendTask::PlaySound(sound_type) => self.queue_play_sound(sound_type),
FrontendTask::HideDashboard => self.action_hide_dashboard(params.data),
@@ -583,6 +585,12 @@ impl<T: 'static> Frontend<T> {
&self.state.fetch_component_as::<ComponentButton>("btn_recenter")?,
FrontendTask::RecenterPlayspace,
);
self.tasks.handle_button(
&self
.state
.fetch_component_as::<ComponentButton>("btn_reset_space_drag")?,
FrontendTask::ResetSpaceDrag,
);
Ok(())
}
@@ -644,6 +652,11 @@ impl<T: 'static> Frontend<T> {
Ok(())
}
fn action_reset_space_drag(&mut self, data: &mut T) -> anyhow::Result<()> {
self.interface.playspace_task(data, DashPlayspaceTask::Reset)?;
Ok(())
}
fn action_hide_dashboard(&mut self, data: &mut T) {
self.interface.toggle_dashboard(data);
}
+2 -2
View File
@@ -33,7 +33,7 @@
#
# Base language: English (en.json)
#
# This tool expects llama.cpp server being present (llama-server) at port 8080.
# This tool expects llama.cpp server being present (llama-server) at port 9931.
#
# Currently we're using Gemma 4 for machine translations.
# Model URL:
@@ -51,7 +51,7 @@ if [ -z "${MODEL}" ]; then
fi
if [ -z "${LLAMA_BASE_URL}" ]; then
export LLAMA_BASE_URL="http://127.0.0.1:8080"
export LLAMA_BASE_URL="http://127.0.0.1:9931"
fi
TEMPLATE="en" bun main.ts
+2 -1
View File
@@ -188,7 +188,7 @@ impl PlayspaceMover {
self.gravity.mark_end_drag(
&app.session.config,
relative_pos,
data.pose.translation,
data.pose.matrix3,
app.delta_time,
);
@@ -283,6 +283,7 @@ impl PlayspaceMover {
config,
floor_height: config.space_gravity_floor_height,
current_space_pos: pose.translation,
current_playspace_rot: pose.matrix3,
})?;
Some(SpaceGravityStepResult {
+25 -29
View File
@@ -1,4 +1,4 @@
use glam::{Affine3A, Vec3A};
use glam::{Affine3A, Mat3A, Vec3A};
use wlx_common::config::GeneralConfig;
use crate::windowing::manager::OverlayWindowManager;
@@ -11,11 +11,12 @@ pub struct SpaceGravityUpdateParams<'a> {
// current playspace offset
pub current_space_pos: Vec3A,
pub current_playspace_rot: Mat3A,
}
pub struct SpaceGravity {
velocity: Vec3A,
space_pos: Vec3A,
velocity: Vec3A, // local space
}
pub fn shift_world<OverlayData>(
@@ -37,14 +38,13 @@ pub fn shift_world<OverlayData>(
}
pub struct SpaceGravityUpdateResult {
pub playspace_pos_offset: Vec3A, // position difference compared to previous update() call
pub playspace_pos_offset: Vec3A, // position difference compared to the previous update() call
}
impl SpaceGravity {
pub fn new() -> Self {
Self {
velocity: Vec3A::default(),
space_pos: Vec3A::default(),
}
}
@@ -52,20 +52,19 @@ impl SpaceGravity {
&mut self,
config: &GeneralConfig,
hand_pos_diff: Vec3A,
space_pos: Vec3A,
space_rot: Mat3A,
dt: f32,
) {
if config.space_gravity_enabled {
self.velocity = hand_pos_diff * config.space_gravity_fling_strength / dt;
self.space_pos = space_pos;
self.velocity =
space_rot.inverse() * hand_pos_diff * config.space_gravity_fling_strength / dt;
} else {
self.reset();
}
}
pub fn reset(&mut self) {
self.velocity = Vec3A::default();
self.space_pos = Vec3A::default();
self.velocity = Default::default();
}
pub fn update(&mut self, par: SpaceGravityUpdateParams) -> Option<SpaceGravityUpdateResult> {
@@ -73,32 +72,29 @@ impl SpaceGravity {
return None;
}
self.space_pos = par.current_space_pos;
let mut velocity = self.velocity;
velocity += Vec3A::new(0.0, par.config.space_gravity_gravity * par.dt, 0.0) /* downwards gravity */;
velocity *= par.config.space_gravity_damping.powf(par.dt * 10.0) /* damping */;
let prev_pos = self.space_pos;
// local space
let prev_pos = par.current_playspace_rot.inverse() * par.current_space_pos;
let mut space_pos = prev_pos;
space_pos += velocity * par.dt;
space_pos.y = space_pos.y.min(par.floor_height);
self.velocity.y += par.config.space_gravity_gravity * par.dt;
// terminal velocity
self.velocity.y = self.velocity.y.min(200.0);
self.velocity *= (par.config.space_gravity_damping).powf(par.dt * 10.0);
self.space_pos += self.velocity * par.dt;
self.space_pos.y = self.space_pos.y.min(par.floor_height);
if self.space_pos.y >= par.floor_height
/* at floor height or below */
{
// at floor height or below
if space_pos.y >= par.floor_height {
// apply ground friction
self.velocity *= 1.0 - par.config.space_gravity_ground_friction * par.dt * 10.0;
velocity *= 1.0 - par.config.space_gravity_ground_friction * par.dt * 10.0;
}
if self.velocity.length_squared() > 0.00003 {
self.velocity = velocity;
let pos_diff = space_pos - prev_pos;
if velocity.length_squared() > 0.00003 {
// Space position changed
return Some(SpaceGravityUpdateResult {
playspace_pos_offset: self.space_pos - prev_pos,
playspace_pos_offset: par.current_playspace_rot * pos_diff,
});
}
+3 -3
View File
@@ -123,10 +123,10 @@ pub trait Fetchable {
/// Fetch a component by widget ID (returns Component)
fn fetch_component_by_widget_id(&self, state: &LayoutState, widget_id: WidgetID) -> anyhow::Result<Component>;
/// Fetch a component by string ID and down‑cast it to a concrete component type `T` (see `components/mod.rs`)
/// Fetch a component by string ID and down-cast it to a concrete component type `T` (see `components/mod.rs`)
fn fetch_component_as<T: 'static>(&self, id: &str) -> anyhow::Result<Rc<T>>;
/// Fetch a component by widget ID and down‑cast it to a concrete component type `T` (see `components/mod.rs`)
/// Fetch a component by widget ID and down-cast it to a concrete component type `T` (see `components/mod.rs`)
fn fetch_component_from_widget_id_as<T: 'static>(
&self,
state: &LayoutState,
@@ -139,7 +139,7 @@ pub trait Fetchable {
/// Retrieve the widget associated with a string ID, returning a `WidgetPair` (id and widget itself)
fn fetch_widget(&self, state: &LayoutState, id: &str) -> anyhow::Result<WidgetPair>;
/// Retrieve a widget by string ID and down‑cast its inner value to type `T` (see `widget/mod.rs`)
/// Retrieve a widget by string ID and down-cast its inner value to type `T` (see `widget/mod.rs`)
fn fetch_widget_as<'a, T: 'static>(&self, state: &'a LayoutState, id: &str) -> anyhow::Result<RefMut<'a, T>>;
}