Forum Discussion
TiyoPAENGski
1 year agoExplorer
Figuring out how to create a hand menu/palm hud
Hi. Is it possible to create a hand menu or palm hud using meta quest sdk? All I can see on the Internet are examples of hand menu using Unity XR Plugin. Please can someone help me? Thank you
4 Replies
Replies have been turned off for this discussion
- tanx1Honored Guest
Ya. I have the same issue.
- JoJueExplorer
Hey, install the Meta XR Interaction SDK OVR Samples via Package Manager. One of the sample scenes 'Poke Examples' has a Palm Menu, that you can use as a template.
- Big_FlexMeta Employee
Yup, JoJue is right. In the PokeExamples scene there's a PalmMenuDialog GameObject that appears when you tap your left index finger and thumb together.
As an alternative solution to the SDK example, you can have a world space canvas attached to the wrist, that only appears when it's facing the player camera. This is the simple version of the activation script:
using UnityEngine; namespace jdp{ public class HandUI_PalmActivation : MonoBehaviour { // Reference to the wrist bone of the tracked VR hand. public Transform wristBoneTransform; // The GameObject to activate/deactivate. public GameObject objectToActivate; // The angle threshold to determine if the palm is facing towards the player. public float activationAngleThreshold = 45.0f; private void Start() { objectToActivate.SetActive(false); } void Update() { // Ensure we have references set if (wristBoneTransform == null || objectToActivate == null) return; // The direction from the wrist bone to the camera/HMD. Vector3 directionToCamera = (Camera.main.transform.position - wristBoneTransform.position).normalized; // The local up vector of the wrist bone when the palm is facing up. // Adjust this if your VR hand's palm up orientation is different. Vector3 palmNormal = wristBoneTransform.forward; // Calculate the angle between the palm's normal vector and the direction to the camera. float angleToCamera = Vector3.Angle(palmNormal, directionToCamera); // Activate the GameObject if the palm is facing the camera within the threshold. if (angleToCamera <= activationAngleThreshold) { objectToActivate.SetActive(true); } else { objectToActivate.SetActive(false); } } } }HandUI opens when looking at the palm of the hand
For extra polish, don't just parent the UI to the wrist but have it smoothly follow the wrist transform (at an offset)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago
- 4 months ago
- 2 years ago