public static bool SetControllerHaptics(uint controllerMask, HapticsBuffer hapticsBuffer) { if (version >= OVRP_1_6_0.version) { return(OVRP_1_6_0.ovrp_SetControllerHaptics(controllerMask, hapticsBuffer) == Bool.True); } else { return(false); } }
static void Postfix(uint controllerMask, HapticsBuffer hapticsBuffer) { // TODO This won't work if SampleSize != 1. Check Sample Size somewhere. byte[] clipBuffer = new byte[hapticsBuffer.SamplesCount]; Marshal.Copy(hapticsBuffer.Samples, clipBuffer, 0, hapticsBuffer.SamplesCount); // If the buffer is nothing but 0s, we don't care about it. if (clipBuffer.Max() != 0) { WriteToStream(new GHRProtocolMessageContainer { UnityXROculusClipHaptics = new UnityXROculusClipHaptics(HandSpec.LEFT, clipBuffer) }); } }
public void Session_SubmitControllerVibration() { IntPtr sessionPtr = CreateSession(); Assert.AreNotEqual(IntPtr.Zero, sessionPtr); byte[] samples = { 0, 64, 128, 255 }; var gcHandle = GCHandle.Alloc(samples, GCHandleType.Pinned); var hapticsBuffer = new HapticsBuffer() { Samples = gcHandle.AddrOfPinnedObject(), SamplesCount = samples.Length, SubmitMode = HapticsBufferSubmitMode.Enqueue }; Result result = OVR.SubmitControllerVibration(sessionPtr, ControllerType.LTouch, hapticsBuffer); gcHandle.Free(); Assert.IsTrue(result >= Result.Success, "Failed to SubmitControllerVibration"); }
public static extern Bool ovrp_SetControllerHaptics(uint controllerMask, HapticsBuffer hapticsBuffer);
public static bool SetControllerHaptics(uint controllerMask, HapticsBuffer hapticsBuffer) { if (version >= OVRP_1_6_0.version) { return OVRP_1_6_0.ovrp_SetControllerHaptics(controllerMask, hapticsBuffer) == Bool.True; } else { return false; } }
public static extern Result ovr_SubmitControllerVibration(ovrSession session, ControllerType controllerType, ref HapticsBuffer buffer);
public static bool SetControllerHaptics(uint controllerMask, HapticsBuffer hapticsBuffer) { return(ovrp_SetControllerHaptics(controllerMask, hapticsBuffer) == Bool.True); }