Allison Huang
Allison Huang

Reputation: 11

Pin something to user's field of vision in A-Frame

I have a visualization that I'd like to pin to the perimeter of a user's field of view in A-Frame. As they look around the scene, users should be able to see a bar in their peripheral vision. Is this possible?

Upvotes: 1

Views: 1487

Answers (1)

ngokevin
ngokevin

Reputation: 13233

https://aframe.io/docs/0.5.0/components/camera.html#fixing-entities-to-the-camera

To fix entities onto the camera such that they stay within view no matter where the user looks, you can attach those entities as a child of the camera. Use cases might be a heads-up display (HUD).

<a-entity camera look-controls>
  <a-entity geometry="primitive: plane; height: 0.2; width: 0.2" position="0 0 -1"
            material="color: gray; opacity: 0.5"></a-entity>
</a-entity>

Note that you should use HUDs sparingly as they cause irritation and eye strain in VR. Consider integrating menus into the fabric of the world itself. If you do create a HUD, make sure that the HUD is more in the center of the field of view such that the user does not have to strain their eyes to read it.

Upvotes: 1

Related Questions