A-Frame Spatial-Marker

Spatial-Marker demo 1 (placeholder) Spatial-Marker demo 2 (placeholder) Spatial-Marker demo 3 (placeholder)
draw in 3D with A-Frame // 24 colors & 4 marker sizes

This simple VR component is made for A‑Frame projects and along the meta‑touch controls inputs. It allows users to draw in 3D space on defined drawing areas using one of their VR controllers.

This Spatial-Marker component embeds its own movement logic using the thumbsticks, so it can be used in any A-Frame scene without any other locomotion system but the use of teleport-controls isn't recommended due to the use of the color palette.


How to use

Place the spatial-marker.js script along with the latest A‑Frame version in the <head> section:

<script src="https://aframe.io/releases/1.7.1/aframe.min.js"></script>
<script src="https://rpetitjean.github.io/spatial-marker/spatial-marker.js"></script>

Place the spatial-marker component as part of your VR rig along the following structure using meta‑touch controls:

<a-entity id="rig" spatial-marker>
  <a-box id="camera" camera="fov:75; near:0.1; far:700" position="0 1.7 0" visible="false"></a-box>
  <a-entity id="left-hand"  meta-touch-controls="hand: left"></a-entity>
  <a-entity id="right-hand" meta-touch-controls="hand: right"></a-entity>
</a-entity>

Set up one or multiple drawing areas using the .drawingArea class:

<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4"
         color="#7BC8A4" opacity="0.0" transparent="true"
         class="drawingArea"></a-plane>

How it works

Navigate in space with the thumbsticks to a defined drawing area.
Grip (yellow) icon placeholder
Define your painting hand with the Grip. Default is the right hand.
B / Y (blue) icon placeholder
Set line size with either B or Y.
A / X (red) icon placeholder
Delete the last line with either A or X.
Trigger icon placeholder
Start painting with the trigger.
Joystick color pick icon placeholder
Pick a color with the non‑drawing hand joystick.

Examples