Add Thumbstick slide over 360 degree
This commit is contained in:
@@ -44,7 +44,7 @@ public class ChildModelSelector : MonoBehaviour, IResettable
|
|||||||
if (label.Length > 0)
|
if (label.Length > 0)
|
||||||
{
|
{
|
||||||
label[0].text = childModel.NameHuman;
|
label[0].text = childModel.NameHuman;
|
||||||
label[1].text = "Bottom Text"; //TODO: add Secondary Text?
|
label[1].text = "";
|
||||||
}
|
}
|
||||||
go.GetComponent<Button>().onClick.AddListener(() => OnClick(childModel));
|
go.GetComponent<Button>().onClick.AddListener(() => OnClick(childModel));
|
||||||
Models.Add(go);
|
Models.Add(go);
|
||||||
|
|||||||
@@ -27,17 +27,26 @@ public class SilderHandler : MonoBehaviour
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
Vector2 joystickInput = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
|
Vector2 joystickInput1 = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
|
||||||
|
|
||||||
if (Mathf.Abs(joystickInput.x) > 0.1f)
|
|
||||||
{
|
|
||||||
rotationSlider.value += joystickInput.x * joystickSpeed * Time.deltaTime;
|
|
||||||
}
|
|
||||||
Vector2 joystickInput2 = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
|
Vector2 joystickInput2 = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
|
||||||
|
|
||||||
|
float joystickInput = joystickInput2.x + joystickInput1.x;
|
||||||
|
|
||||||
if (Mathf.Abs(joystickInput2.x) > 0.1f)
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user