-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFFBClient.cs
36 lines (32 loc) · 977 Bytes
/
FFBClient.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using UnityEngine;
using Valve.VR;
using Valve.VR.InteractionSystem;
public class FFBClient : MonoBehaviour
{
private FFBManager _ffbManager;
private void Awake()
{
_ffbManager = GameObject.FindObjectOfType<FFBManager>();
}
private void OnHandHoverBegin(Hand hand)
{
Debug.Log("Received Hand hover event");
SteamVR_Skeleton_Pose_Hand skeletonPoseHand;
if (hand.handType == SteamVR_Input_Sources.LeftHand)
{
skeletonPoseHand = GetComponent<Interactable>().skeletonPoser.skeletonMainPose.leftHand;
}
else
{
skeletonPoseHand = GetComponent<Interactable>().skeletonPoser.skeletonMainPose.rightHand;
}
_ffbManager.SetForceFeedbackFromSkeleton(hand, skeletonPoseHand);
}
private void OnHandHoverEnd(Hand hand)
{
if (!hand.currentAttachedObject)
{
_ffbManager.RelaxForceFeedback(hand);
}
}
}