зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1601837 - Using current available slot to access controllerState instead of hand index in OpenVR. r=kip
We notice we didn't write states info ControllerState correctly before because sometimes there is only one controller (right hand), it will try to access the slot 1 instead of the current available slot 0. That makes us can't see this controller is available. Differential Revision: https://phabricator.services.mozilla.com/D56243 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
21a6a77032
Коммит
b5abcaa367
|
@ -1388,22 +1388,22 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
|
||||
for (uint32_t stateIndex = 0; stateIndex < kVRControllerMaxCount;
|
||||
++stateIndex) {
|
||||
OpenVRHand trackedDevice = mControllerDeviceIndex[stateIndex];
|
||||
if (trackedDevice == OpenVRHand::None) {
|
||||
const OpenVRHand role = mControllerDeviceIndex[stateIndex];
|
||||
if (role == OpenVRHand::None) {
|
||||
continue;
|
||||
}
|
||||
VRControllerState& controllerState = aState.controllerState[stateIndex];
|
||||
controllerState.hand = GetControllerHandFromControllerRole(trackedDevice);
|
||||
controllerState.hand = GetControllerHandFromControllerRole(role);
|
||||
|
||||
uint32_t axisIdx = 0;
|
||||
uint32_t buttonIdx = 0;
|
||||
// Axis 0 1: Trackpad
|
||||
// Button 0: Trackpad
|
||||
vr::InputAnalogActionData_t analogData;
|
||||
if (mControllerHand[stateIndex].mActionTrackpad_Analog.handle &&
|
||||
if (mControllerHand[role].mActionTrackpad_Analog.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionTrackpad_Analog.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionTrackpad_Analog.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
controllerState.axisValue[axisIdx] = analogData.x;
|
||||
|
@ -1415,10 +1415,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
bool bPressed = false;
|
||||
bool bTouched = false;
|
||||
uint64_t mask = 0;
|
||||
if (mControllerHand[stateIndex].mActionTrackpad_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionTrackpad_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionTrackpad_Pressed.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionTrackpad_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
bPressed = actionData.bState;
|
||||
|
@ -1429,10 +1429,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionTrackpad_Touched.handle &&
|
||||
if (mControllerHand[role].mActionTrackpad_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionTrackpad_Touched.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionTrackpad_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
mask = (1ULL << buttonIdx);
|
||||
|
@ -1446,10 +1446,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 1: Trigger
|
||||
if (mControllerHand[stateIndex].mActionTrigger_Value.handle &&
|
||||
if (mControllerHand[role].mActionTrigger_Value.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionTrigger_Value.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionTrigger_Value.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
UpdateTrigger(controllerState, buttonIdx, analogData.x, triggerThreshold);
|
||||
|
@ -1457,9 +1457,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 2: Grip
|
||||
if (mControllerHand[stateIndex].mActionGrip_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionGrip_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionGrip_Pressed.handle, &actionData,
|
||||
mControllerHand[role].mActionGrip_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
|
@ -1471,10 +1471,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionGrip_Touched.handle &&
|
||||
if (mControllerHand[role].mActionGrip_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionGrip_Touched.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionGrip_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
mask = (1ULL << buttonIdx);
|
||||
|
@ -1488,9 +1488,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 3: Menu
|
||||
if (mControllerHand[stateIndex].mActionMenu_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionMenu_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionMenu_Pressed.handle, &actionData,
|
||||
mControllerHand[role].mActionMenu_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
|
@ -1502,10 +1502,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionMenu_Touched.handle &&
|
||||
if (mControllerHand[role].mActionMenu_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionMenu_Touched.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionMenu_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
mask = (1ULL << buttonIdx);
|
||||
|
@ -1519,10 +1519,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 3: System
|
||||
if (mControllerHand[stateIndex].mActionSystem_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionSystem_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionSystem_Pressed.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionSystem_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
bPressed = actionData.bState;
|
||||
|
@ -1533,10 +1533,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionSystem_Touched.handle &&
|
||||
if (mControllerHand[role].mActionSystem_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionSystem_Touched.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionSystem_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
mask = (1ULL << buttonIdx);
|
||||
|
@ -1550,9 +1550,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 4: A
|
||||
if (mControllerHand[stateIndex].mActionA_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionA_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionA_Pressed.handle, &actionData,
|
||||
mControllerHand[role].mActionA_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
|
@ -1564,9 +1564,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionA_Touched.handle &&
|
||||
if (mControllerHand[role].mActionA_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionA_Touched.handle, &actionData,
|
||||
mControllerHand[role].mActionA_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
|
@ -1581,9 +1581,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 5: B
|
||||
if (mControllerHand[stateIndex].mActionB_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionB_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionB_Pressed.handle, &actionData,
|
||||
mControllerHand[role].mActionB_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
|
@ -1595,9 +1595,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionB_Touched.handle &&
|
||||
if (mControllerHand[role].mActionB_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionB_Touched.handle, &actionData,
|
||||
mControllerHand[role].mActionB_Touched.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
|
@ -1613,10 +1613,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
|
||||
// Axis 2 3: Thumbstick
|
||||
// Button 6: Thumbstick
|
||||
if (mControllerHand[stateIndex].mActionThumbstick_Analog.handle &&
|
||||
if (mControllerHand[role].mActionThumbstick_Analog.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionThumbstick_Analog.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionThumbstick_Analog.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
controllerState.axisValue[axisIdx] = analogData.x;
|
||||
|
@ -1624,10 +1624,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
controllerState.axisValue[axisIdx] = analogData.y * yAxisInvert;
|
||||
++axisIdx;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionThumbstick_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionThumbstick_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionThumbstick_Pressed.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionThumbstick_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
bPressed = actionData.bState;
|
||||
|
@ -1638,9 +1638,9 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
} else {
|
||||
controllerState.buttonPressed &= ~mask;
|
||||
}
|
||||
if (mControllerHand[stateIndex].mActionThumbstick_Touched.handle &&
|
||||
if (mControllerHand[role].mActionThumbstick_Touched.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionThumbstick_Touched.handle,
|
||||
mControllerHand[role].mActionThumbstick_Touched.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None) {
|
||||
bTouched = actionData.bActive && actionData.bState;
|
||||
|
@ -1655,10 +1655,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 7: Bumper (Cosmos only)
|
||||
if (mControllerHand[stateIndex].mActionBumper_Pressed.handle &&
|
||||
if (mControllerHand[role].mActionBumper_Pressed.handle &&
|
||||
vr::VRInput()->GetDigitalActionData(
|
||||
mControllerHand[stateIndex].mActionBumper_Pressed.handle,
|
||||
&actionData, sizeof(actionData),
|
||||
mControllerHand[role].mActionBumper_Pressed.handle, &actionData,
|
||||
sizeof(actionData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
actionData.bActive) {
|
||||
bPressed = actionData.bState;
|
||||
|
@ -1673,10 +1673,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 7: Finger index
|
||||
if (mControllerHand[stateIndex].mActionFingerIndex_Value.handle &&
|
||||
if (mControllerHand[role].mActionFingerIndex_Value.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionFingerIndex_Value.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionFingerIndex_Value.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
UpdateTrigger(controllerState, buttonIdx, analogData.x, triggerThreshold);
|
||||
|
@ -1684,10 +1684,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 8: Finger middle
|
||||
if (mControllerHand[stateIndex].mActionFingerMiddle_Value.handle &&
|
||||
if (mControllerHand[role].mActionFingerMiddle_Value.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionFingerMiddle_Value.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionFingerMiddle_Value.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
UpdateTrigger(controllerState, buttonIdx, analogData.x, triggerThreshold);
|
||||
|
@ -1695,10 +1695,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 9: Finger ring
|
||||
if (mControllerHand[stateIndex].mActionFingerRing_Value.handle &&
|
||||
if (mControllerHand[role].mActionFingerRing_Value.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionFingerRing_Value.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionFingerRing_Value.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
UpdateTrigger(controllerState, buttonIdx, analogData.x, triggerThreshold);
|
||||
|
@ -1706,10 +1706,10 @@ void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
|
|||
}
|
||||
|
||||
// Button 10: Finger pinky
|
||||
if (mControllerHand[stateIndex].mActionFingerPinky_Value.handle &&
|
||||
if (mControllerHand[role].mActionFingerPinky_Value.handle &&
|
||||
vr::VRInput()->GetAnalogActionData(
|
||||
mControllerHand[stateIndex].mActionFingerPinky_Value.handle,
|
||||
&analogData, sizeof(analogData),
|
||||
mControllerHand[role].mActionFingerPinky_Value.handle, &analogData,
|
||||
sizeof(analogData),
|
||||
vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None &&
|
||||
analogData.bActive) {
|
||||
UpdateTrigger(controllerState, buttonIdx, analogData.x, triggerThreshold);
|
||||
|
@ -1850,11 +1850,16 @@ void OpenVRSession::UpdateControllerButtonsObsolete(VRSystemState& aState) {
|
|||
void OpenVRSession::UpdateControllerPoses(VRSystemState& aState) {
|
||||
MOZ_ASSERT(mVRSystem);
|
||||
|
||||
for (int8_t handIndex = 0; handIndex < OpenVRHand::Total; ++handIndex) {
|
||||
VRControllerState& controllerState = aState.controllerState[handIndex];
|
||||
for (uint32_t stateIndex = 0; stateIndex < kVRControllerMaxCount;
|
||||
++stateIndex) {
|
||||
const OpenVRHand role = mControllerDeviceIndex[stateIndex];
|
||||
if (role == OpenVRHand::None) {
|
||||
continue;
|
||||
}
|
||||
VRControllerState& controllerState = aState.controllerState[stateIndex];
|
||||
vr::InputPoseActionData_t poseData;
|
||||
if (vr::VRInput()->GetPoseActionData(
|
||||
mControllerHand[handIndex].mActionPose.handle,
|
||||
mControllerHand[role].mActionPose.handle,
|
||||
vr::TrackingUniverseSeated, 0, &poseData, sizeof(poseData),
|
||||
vr::k_ulInvalidInputValueHandle) != vr::VRInputError_None ||
|
||||
!poseData.bActive || !poseData.pose.bPoseIsValid) {
|
||||
|
@ -2183,27 +2188,17 @@ void OpenVRSession::VibrateHaptic(uint32_t aControllerIdx,
|
|||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"OpenVRSession::StartHapticThread", [this]() { StartHapticThread(); }));
|
||||
}
|
||||
|
||||
if (aHapticIndex >= kNumOpenVRHaptics ||
|
||||
aControllerIdx >= kVRControllerMaxCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
OpenVRHand deviceIndex = mControllerDeviceIndex[aControllerIdx];
|
||||
if (deviceIndex == OpenVRHand::None) {
|
||||
const OpenVRHand role = mControllerDeviceIndex[aControllerIdx];
|
||||
if (role == OpenVRHand::None) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHapticPulseRemaining[aControllerIdx][aHapticIndex] = aDuration;
|
||||
mHapticPulseIntensity[aControllerIdx][aHapticIndex] = aIntensity;
|
||||
|
||||
/**
|
||||
* TODO - The haptic feedback pulses will have latency of one frame and we
|
||||
* are simulating intensity with pulse-width modulation.
|
||||
* We should use of the OpenVR Input API to correct this
|
||||
* and replace the TriggerHapticPulse calls which have been
|
||||
* deprecated.
|
||||
*/
|
||||
}
|
||||
|
||||
void OpenVRSession::StartHapticThread() {
|
||||
|
@ -2274,28 +2269,27 @@ void OpenVRSession::UpdateHaptics() {
|
|||
float deltaTime = (float)(now - mLastHapticUpdate).ToSeconds();
|
||||
mLastHapticUpdate = now;
|
||||
|
||||
for (int iController = 0; iController < kVRControllerMaxCount;
|
||||
iController++) {
|
||||
for (int iHaptic = 0; iHaptic < kNumOpenVRHaptics; iHaptic++) {
|
||||
OpenVRHand deviceIndex = mControllerDeviceIndex[iController];
|
||||
if (deviceIndex == OpenVRHand::None) {
|
||||
continue;
|
||||
}
|
||||
float intensity = mHapticPulseIntensity[iController][iHaptic];
|
||||
float duration = mHapticPulseRemaining[iController][iHaptic];
|
||||
for (uint32_t stateIndex = 0; stateIndex < kVRControllerMaxCount;
|
||||
++stateIndex) {
|
||||
const OpenVRHand role = mControllerDeviceIndex[stateIndex];
|
||||
if (role == OpenVRHand::None) {
|
||||
continue;
|
||||
}
|
||||
for (uint32_t hapticIdx = 0; hapticIdx < kNumOpenVRHaptics; hapticIdx++) {
|
||||
float intensity = mHapticPulseIntensity[stateIndex][hapticIdx];
|
||||
float duration = mHapticPulseRemaining[stateIndex][hapticIdx];
|
||||
if (duration <= 0.0f || intensity <= 0.0f) {
|
||||
continue;
|
||||
}
|
||||
vr::VRInput()->TriggerHapticVibrationAction(
|
||||
mControllerHand[iController].mActionHaptic.handle, 0.0f, deltaTime,
|
||||
4.0f, intensity > 1.0 ? 1.0 : intensity,
|
||||
vr::k_ulInvalidInputValueHandle);
|
||||
mControllerHand[role].mActionHaptic.handle, 0.0f, deltaTime, 4.0f,
|
||||
intensity > 1.0f ? 1.0f : intensity, vr::k_ulInvalidInputValueHandle);
|
||||
|
||||
duration -= deltaTime;
|
||||
if (duration < 0.0f) {
|
||||
duration = 0.0f;
|
||||
}
|
||||
mHapticPulseRemaining[iController][iHaptic] = duration;
|
||||
mHapticPulseRemaining[stateIndex][hapticIdx] = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче