34 lines
770 B
C#
34 lines
770 B
C#
using UnityEngine;
|
|
using UnityEngine.XR;
|
|
|
|
namespace BlockSpace.Voxels
|
|
{
|
|
internal static class VRHaptics
|
|
{
|
|
public const float SmallAmplitude = 0.18f;
|
|
|
|
public const float MediumAmplitude = 0.32f;
|
|
|
|
public const float LargeAmplitude = 0.65f;
|
|
|
|
public const float TickDuration = 0.035f;
|
|
|
|
public const float ToolDuration = 0.055f;
|
|
|
|
public const float BigDuration = 0.11f;
|
|
|
|
public static void Pulse(InputDevice device, float amplitude, float duration)
|
|
{
|
|
if (device.isValid && !(amplitude <= 0f) && !(duration <= 0f))
|
|
{
|
|
device.SendHapticImpulse(0u, Mathf.Clamp01(amplitude), duration);
|
|
}
|
|
}
|
|
|
|
public static void Pulse(XRNode node, float amplitude, float duration)
|
|
{
|
|
Pulse(InputDevices.GetDeviceAtXRNode(node), amplitude, duration);
|
|
}
|
|
}
|
|
}
|