Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New interactable class with handedness, close #128 #137

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Assets/NewtonVR/NVRButtonInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public bool PressDown
{
if (PressDownExpired)
{
PressDownCached = InputDevice.GetPressDown(nvrbutton);
PressDownCached = (InputDevice != null) ? InputDevice.GetPressDown(nvrbutton) : false;
PressDownExpired = false;
}
return PressDownCached;
Expand All @@ -31,7 +31,7 @@ public bool PressUp
{
if (PressUpExpired)
{
PressUpCached = InputDevice.GetPressUp(nvrbutton);
PressUpCached = (InputDevice != null) ? InputDevice.GetPressUp(nvrbutton) : false;
PressUpExpired = false;
}
return PressUpCached;
Expand All @@ -48,7 +48,7 @@ public bool IsPressed
{
if (IsPressedExpired)
{
IsPressedCached = InputDevice.GetPress(nvrbutton);
IsPressedCached = (InputDevice != null) ? InputDevice.GetPress(nvrbutton) : false;
IsPressedExpired = false;
}
return IsPressedCached;
Expand All @@ -65,7 +65,7 @@ public bool TouchDown
{
if (TouchDownExpired)
{
TouchDownCached = InputDevice.GetTouchDown(nvrbutton);
TouchDownCached = (InputDevice != null) ? InputDevice.GetTouchDown(nvrbutton) : false;
TouchDownExpired = false;
}
return TouchDownCached;
Expand All @@ -82,7 +82,7 @@ public bool TouchUp
{
if (TouchUpExpired)
{
TouchUpCached = InputDevice.GetTouchUp(nvrbutton);
TouchUpCached = (InputDevice != null) ? InputDevice.GetTouchUp(nvrbutton) : false;
TouchUpExpired = false;
}
return TouchUpCached;
Expand All @@ -99,7 +99,7 @@ public bool IsTouched
{
if (IsTouchedExpired)
{
IsTouchedCached = InputDevice.GetTouch(nvrbutton);
IsTouchedCached = (InputDevice != null) ? InputDevice.GetTouch(nvrbutton) : false;
IsTouchedExpired = false;
}
return IsTouchedCached;
Expand All @@ -116,7 +116,7 @@ public bool NearTouchDown
{
if (NearTouchDownExpired)
{
NearTouchDownCached = InputDevice.GetNearTouchDown(nvrbutton);
NearTouchDownCached = (InputDevice != null) ? InputDevice.GetNearTouchDown(nvrbutton) : false;
NearTouchDownExpired = false;
}
return NearTouchDownCached;
Expand All @@ -133,7 +133,7 @@ public bool NearTouchUp
{
if (NearTouchUpExpired)
{
NearTouchUpCached = InputDevice.GetNearTouchUp(nvrbutton);
NearTouchUpCached = (InputDevice != null) ? InputDevice.GetNearTouchUp(nvrbutton) : false;
NearTouchUpExpired = false;
}
return NearTouchUpCached;
Expand All @@ -150,7 +150,7 @@ public bool IsNearTouched
{
if (IsNearTouchedExpired)
{
IsNearTouchedCached = InputDevice.GetNearTouch(nvrbutton);
IsNearTouchedCached = (InputDevice != null) ? InputDevice.GetNearTouch(nvrbutton) : false;
IsNearTouchedExpired = false;
}
return IsNearTouchedCached;
Expand All @@ -167,7 +167,7 @@ public Vector2 Axis
{
if (AxisExpired)
{
AxisCached = InputDevice.GetAxis2D(nvrbutton);
AxisCached = (InputDevice != null) ? InputDevice.GetAxis2D(nvrbutton) : Vector2.zero;
AxisExpired = false;
}
return AxisCached;
Expand All @@ -184,7 +184,7 @@ public float SingleAxis
{
if (SingleAxisExpired)
{
SingleAxisCached = InputDevice.GetAxis1D(nvrbutton);
SingleAxisCached = (InputDevice != null) ? InputDevice.GetAxis1D(nvrbutton) : 0f;
SingleAxisExpired = false;
}
return SingleAxisCached;
Expand Down
Loading