Add Slider Controller Thumbstick support

This commit is contained in:
FlorianSpeicher
2025-07-07 21:37:57 +02:00
parent c2ab6d0bb0
commit 340a8d79fc
2 changed files with 13 additions and 37 deletions

View File

@@ -14422,29 +14422,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d376240d064f4484e81824d51391caf3, type: 3}
m_Name:
m_EditorClassIdentifier:
_buttonClickActions:
- Title:
Button: 2
ButtonMode: 1
InputActionReference: {fileID: 0}
CallbackWithContext:
m_PersistentCalls:
m_Calls: []
Callback:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.Object, UnityEngine
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_buttonClickActions: []
--- !u!114 &815235904
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -26849,7 +26827,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1591058970}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
@@ -26910,7 +26888,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1591058970}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2518c50cb3fc6a6458d4b743c2f69c7d, type: 3}
m_Name:

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class SilderHandler : MonoBehaviour
@@ -26,20 +27,17 @@ public class SilderHandler : MonoBehaviour
void Update()
{
float joystickInput = 0f;
try
{
joystickInput = Input.GetAxis("Oculus_CrossPlatform_SecondaryThumbstickHorizontal");
}
catch
{
// Keine Achse vorhanden oder kein Controller angeschlossen
joystickInput = 0f;
}
Vector2 joystickInput = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
if (Mathf.Abs(joystickInput) > 0.1f)
if (Mathf.Abs(joystickInput.x) > 0.1f)
{
rotationSlider.value += joystickInput * joystickSpeed * Time.deltaTime;
rotationSlider.value += joystickInput.x * joystickSpeed * Time.deltaTime;
}
Vector2 joystickInput2 = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
if (Mathf.Abs(joystickInput2.x) > 0.1f)
{
rotationSlider.value += joystickInput2.x * joystickSpeed * Time.deltaTime;
}
}