Skip to main content
New Participant
March 10, 2024

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

    This topic has been closed for replies.

    4 replies

    New Participant
    March 11, 2024

    Ya. I have the same issue.

    Participant
    March 11, 2024

    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.

    BigFlex
    Meta Employee
    March 11, 2024

    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.

    Honored Contributor
    March 13, 2024

    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)