Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨

3 Replies

Replies have been turned off for this discussion
  • Hi! 

    The recommended way to get users head position for placing screens is via the AvatarAttachment component.

    You can get the local head pose like so: 

    // Function to get the pose of the user's head
    fun getHeadPose(): Pose {
      val head =
          Query.where { has(AvatarAttachment.id) }
              .filter { isLocal() and by(AvatarAttachment.typeData).isEqualTo("head") }
              .eval()
              .first()
      return head.getComponent<Transform>().transform
    }

     

    • waynecochran's avatar
      waynecochran
      Protege

      Yes, I have that exact code. But where is the head on the human body exactly? Is it the C1 vertebrae? Center of skull? midpoint between eyes?

      • Bulkywallnut's avatar
        Bulkywallnut
        Meta Employee

        Hi,

        It is the location of the headset in 3D Space.
        For rendering purposes, it is also the midpoint between both eyes.