openvr haptics
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{array, io::Write, path::Path};
|
||||
use std::{array, io::Write, path::Path, time::Duration};
|
||||
|
||||
use ovr_overlay::{
|
||||
input::{ActionHandle, ActionSetHandle, ActiveActionSet, InputManager, InputValueHandle},
|
||||
@@ -11,7 +11,7 @@ use ovr_overlay::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
backend::input::{TrackedDevice, TrackedDeviceRole},
|
||||
backend::input::{Haptics, TrackedDevice, TrackedDeviceRole},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
@@ -119,6 +119,18 @@ impl OpenVrInputSource {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn haptics(&mut self, input: &mut InputManager, hand: usize, haptics: &Haptics) {
|
||||
let hnd = self.hands[hand].haptics_hnd;
|
||||
let _ = input.trigger_haptic_vibration_action(
|
||||
hnd,
|
||||
0.0,
|
||||
Duration::from_secs_f32(haptics.duration),
|
||||
haptics.frequency,
|
||||
haptics.intensity,
|
||||
INPUT_ANY,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
&mut self,
|
||||
input: &mut InputManager,
|
||||
|
||||
Reference in New Issue
Block a user