cursor mesh with temporary visual (fixes #20)

This commit is contained in:
Kevin Ngo
2018-09-20 05:56:56 -07:00
parent 61870d3d49
commit ff263a439b
4 changed files with 55 additions and 1 deletions

View File

@@ -31,6 +31,7 @@
<audio id="hoverSound" src="assets/sounds/hover.ogg"></audio>
<audio id="saberDraw" src="assets/sounds/saberDraw.wav"></audio>
<img id="cursorMeshImage" src="assets/img/cursor-mesh.png">
<img id="gridImg" src="assets/img/grid.png">
<img id="playImg" src="assets/img/play.png">
<img id="sliceImg" src="assets/img/slice.png">
@@ -70,6 +71,7 @@
<a-entity geometry="primitive: cylinder; height: 0.1834; radius: 0.0085" material="color: {{ color }}; shader: flat; opacity: 0.04"></a-entity>
</a-entity>
<a-entity
id="{{ hand }}Cursor"
class="raycaster"
mixin="raycaster"
bind__raycaster="enabled: menu.active && activeHand === '{{ hand }}'; showLine: menu.active && activeHand === '{{ hand }}'"
@@ -82,9 +84,16 @@
{{ saber('right', 'left', 'cyan') }}
</a-entity>
<a-mixin
id="cursorMesh"
geometry="primitive: plane; width: 0.26; height: 0.26"
material="shader: flat; color: white; transparent: true; src: #cursorMeshImage; side: both; depthTest: false"></a-mixin>
<a-entity id="leftCursorMesh" mixin="cursorMesh" cursor-mesh="cursorEl: #leftCursor"></a-entity>
<a-entity id="rightCursorMesh" mixin="cursorMesh" cursor-mesh="cursorEl: #rightCursor"></a-entity>
{% if not IS_PRODUCTION %}
<a-entity id="mouseCursor" mixin="raycaster" cursor="rayOrigin: mouse"
bind__raycaster="enabled: !inVR" raycaster="showLine: false"></a-entity>
<a-entity id="mouseCursorMesh" mixin="cursorMesh" cursor-mesh="cursorEl: #mouseCursor"></a-entity>
{% endif %}
</a-scene>
</body>