Add Thumbstick slide over 360 degree

This commit is contained in:
FlorianSpeicher
2025-07-07 23:41:29 +02:00
parent 02f9407e00
commit 4fe25dc510
2 changed files with 18 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ public class ChildModelSelector : MonoBehaviour, IResettable
if (label.Length > 0)
{
label[0].text = childModel.NameHuman;
label[1].text = "Bottom Text"; //TODO: add Secondary Text?
label[1].text = "";
}
go.GetComponent<Button>().onClick.AddListener(() => OnClick(childModel));
Models.Add(go);

View File

@@ -27,17 +27,26 @@ public class SilderHandler : MonoBehaviour
void Update()
{
Vector2 joystickInput = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
if (Mathf.Abs(joystickInput.x) > 0.1f)
{
rotationSlider.value += joystickInput.x * joystickSpeed * Time.deltaTime;
}
Vector2 joystickInput1 = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
Vector2 joystickInput2 = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
if (Mathf.Abs(joystickInput2.x) > 0.1f)
float joystickInput = joystickInput2.x + joystickInput1.x;
if (Mathf.Abs(joystickInput) > 0.1f)
{
rotationSlider.value += joystickInput2.x * joystickSpeed * Time.deltaTime;
var delta = joystickInput * joystickSpeed * Time.deltaTime;
if (rotationSlider.value + delta > rotationSlider.maxValue)
{
rotationSlider.value = rotationSlider.minValue;
}
else if (rotationSlider.value + delta < rotationSlider.minValue)
{
rotationSlider.value = rotationSlider.maxValue;
}
else
{
rotationSlider.value += delta;
}
}
}