fix(input): input not working

This commit is contained in:
Nova
2024-06-06 06:41:27 -04:00
parent 8d2aac12d6
commit 9425d30cb3
13 changed files with 87 additions and 85 deletions

View File

@@ -54,8 +54,9 @@ impl SkController {
}
pub fn update(&mut self, token: &MainThreadToken) {
let controller = Input::controller(self.handed);
*self.input.enabled.lock() = controller.tracked.is_active();
if *self.input.enabled.lock() {
let input_node = self.input.spatial.node().unwrap();
input_node.set_enabled(controller.tracked.is_active());
if input_node.enabled() {
let world_transform = Mat4::from_rotation_translation(
controller.aim.orientation.into(),
controller.aim.position.into(),

View File

@@ -63,8 +63,10 @@ impl SkHand {
if let InputDataType::Hand(hand) = &mut *self.input.data.lock() {
let controller_active =
controller_enabled && Input::controller(self.handed).is_tracked();
*self.input.enabled.lock() = !controller_active && sk_hand.tracked.is_active();
if *self.input.enabled.lock() {
let input_node = self.input.spatial.node().unwrap();
input_node.set_enabled(!controller_active && sk_hand.tracked.is_active());
if input_node.enabled() {
hand.thumb.tip = convert_joint(sk_hand.fingers[0][4]);
hand.thumb.distal = convert_joint(sk_hand.fingers[0][3]);
hand.thumb.proximal = convert_joint(sk_hand.fingers[0][2]);