ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
5.97k stars 1.27k forks source link

Joysitck not work when click or touch is added #1828

Open DatanIMU opened 3 weeks ago

DatanIMU commented 3 weeks ago

when code like this, everything is OK vr::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/x", &inputhandles[MyComponent_joystick_x], vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided); r::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/y", &inputhandles[MyComponent_joystick_y], vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided);

vr::VRDriverInput()->UpdateScalarComponent(inputhandles[MyComponent_joystick_x], 0.4, 0.0); vr::VRDriverInput()->UpdateScalarComponent(inputhandles[MyComponent_joystick_y], 0.4, 0.0);

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


~~~~~~~~~~~~~`

when code like this: NOT WORK
vr::VRDriverInput()->CreateBooleanComponent(container, "/input/joystick/click", &input_handles_[MyComponent_joystick_click]);
vr::VRDriverInput()->CreateBooleanComponent(container, "/input/joystick/touch", &input_handles_[MyComponent_joystick_touch]);
vr::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/x", &input_handles_[MyComponent_joystick_x], vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided);
r::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/y", &input_handles_[MyComponent_joystick_y], vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided);

vr::VRDriverInput()->UpdateBooleanComponent(input_handles_[MyComponent_joystick_touch], 1, 0.0);
vr::VRDriverInput()->UpdateScalarComponent(input_handles_[MyComponent_joystick_x], 0.4, 0.0);
vr::VRDriverInput()->UpdateScalarComponent(input_handles_[MyComponent_joystick_y], 0.4, 0.0);
DatanIMU commented 3 weeks ago

{ "jsonid": "input_profile", "controller_type": "mycontroller", "input_bindingui_mode": "single_device", "input_bindingui_left": { "image": "{simplecontroller}/icons/sample_controller.svg" }, "input_bindingui_right": { "image": "{simplecontroller}/icons/sample_controller.svg" }, "input_source": { "/input/a": { "binding_image_point": [ 80, 60 ], "type": "button", "touch": true, "order": 1 }, "/input/b": { "binding_image_point": [ 80, 60 ], "type": "button", "touch": true, "order": 2 }, "/input/joystick": { "binding_image_point": [ 80, 60 ], "type": "joystick", "click": true, "touch": true, "order" : 3 }, "/input/trackpad": { "binding_image_point": [ 80, 60 ], "type": "trackpad", "force" : true, "click": true, "touch": true, "order" : 4 } }, "default_bindings": [] }