cancel
Showing results for 
Search instead for 
Did you mean: 

Reproducible crash in Oculus Integration v31.2 using OVRHaptics

Anonymous
Not applicable

Reporting bugs on this forum feels like whispering in the wind, but here goes:

 

  • Oculus Quest is set to "Auto Switch between hands and controllers"
  • Application built with Oculus Integration v31.2 (legacy OVRPlugin) configured to use hands and controllers
  • Launch application in "hand tracking" mode
  • Once application is running switch to controllers
  • Attempt to play a properly configured OVRHapticsClip
  • Crash (if you're running ARM64 build)

Expected results:

  • No crash

If running ARM64 build (IL2CPP):

E CRASH : Cause: null pointer dereference

 

If running ARM7 build (Mono):

E Unity : ArgumentNullException: Value cannot be null.
E Unity : Parameter name: dest
E Unity : at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.copy_to_unmanaged(System.Array,int,intptr,int)
E Unity : at System.Runtime.InteropServices.Marshal.Copy (System.Byte[] source, System.Int32 startIndex, System.IntPtr destination, System.Int32 length) [0x00000] in <8cb436e1877f4e87804bd45a3de980ae>:0
E Unity : at OVRHaptics+OVRHapticsOutput.Process () [0x001d5] in <project path>\Assets\Oculus\VR\Scripts\OVRHaptics.cs:227
E Unity : at OVRHaptics.Process () [0x0000c] in <project path>\Assets\Oculus\VR\Scripts\OVRHaptics.cs:381
E Unity : at OVRManager.LateUpdate () [0x00001] in <project path>\Assets\Oculus\VR\Scripts\OVRManager.cs:2010

 

I'm definitely not passing a null OVRHapticsClip, and if I launch the app in controller mode the haptic plays correctly.

 

Theory: If you start the app in hand tracking mode this call doesn't return what you're expecting:

// OVRHaptics.cs line 67
OVRPlugin.HapticsDesc desc = OVRPlugin.GetControllerHapticsDesc((uint)OVRPlugin.Controller.RTouch);

 

1 REPLY 1

UpUpDnDn
Explorer

I can confirm that this is still an issue with Oculus Integration v40 and all of the other settings you listed above.  Your theory is correct, GetControllerHapticsDesc() returns invalid values if hand tracking is active when the app is launched.  These invalid values cause m_nativeBuffer to be initialized with a capacity of 0, which leads to a crash in OVRHapticsOutput.Process() when Marshal.Copy() attempts to copy data into the empty buffer.

 

The crash can be prevented by wrapping each call to Marshal.Copy() with an if statement that checks whether m_nativeBuffer.GetCapacity() is large enough to accept the data being copied.  The side effect is that the haptics simply won't work if you switch from hand tracking to controllers after the app starts.  Making this change yourself also means you will have to manually restore your edits to OVRHaptics.cs every time you update the Oculus Integration scripts, at least until the issue with GetControllerHapticsDesc() is fixed.