Skip to content

Commit

Permalink
bug fix: annotation boxes must look at camera, in and outside vr
Browse files Browse the repository at this point in the history
  • Loading branch information
weddingdj committed Jul 5, 2019
1 parent 1b9303b commit 9601103
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions js/isvr-vr-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ AFRAME.registerComponent('isvr-vr-mode', {
self.camera_wrapper_pos = camera_wrapper.getAttribute('position');
camera_wrapper.setAttribute('position', { x: 0, y: 0, z: self.data.camera_distance_vr });

var annotation_wrappers = document.querySelectorAll('.annotation-wrapper');
for (var i=0; i<annotation_wrappers.length; i++) {
annotation_wrappers[i].setAttribute('look-at', '#camera');
}


var primaryHand = document.createElement('a-entity');
primaryHand.setAttribute('id', 'primaryHand');
primaryHand.setAttribute('mixin', 'hand');
primaryHand.setAttribute('oculus-touch-controls', {hand: 'right'});
primaryHand.setAttribute('vive-controls', {hand: 'right'});
primaryHand.setAttribute('windows-motion-controls', {hand: 'right'});
primaryHand.setAttribute('daydream-controls', 'right');
primaryHand.setAttribute('gearvr-controls', 'right');
primaryHand.setAttribute('daydream-controls', { hand: 'right'});
primaryHand.setAttribute('gearvr-controls', { hand: 'right'});
primaryHand.setAttribute('oculus-go-controls', { hand: 'right'});
camera_wrapper.appendChild(primaryHand);

var secondaryHand = document.createElement('a-entity');
Expand All @@ -47,8 +53,9 @@ AFRAME.registerComponent('isvr-vr-mode', {
secondaryHand.setAttribute('oculus-touch-controls', {hand: 'left'});
secondaryHand.setAttribute('vive-controls', {hand: 'left'});
secondaryHand.setAttribute('windows-motion-controls', {hand: 'left'});
secondaryHand.setAttribute('daydream-controls', 'left');
secondaryHand.setAttribute('gearvr-controls', 'left');
secondaryHand.setAttribute('daydream-controls', { hand: 'left'});
secondaryHand.setAttribute('gearvr-controls', { hand: 'left'});
secondaryHand.setAttribute('oculus-go-controls', { hand: 'left'});
camera_wrapper.appendChild(secondaryHand);
});

Expand Down
1 change: 1 addition & 0 deletions views/scene.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class="ply-model"

<a-entity
look-at="#look-at"
class="annotation-wrapper"
scale="{{ (isset($content['model'][0]['hotspot-scale'])?$content['model'][0]['hotspot-scale']['#value']:'1 1 1') }}"
position="{{ $annotation['#position']['#x'] }} {{ $annotation['#position']['#y'] }} {{ $annotation['#position']['#z'] }}"
rotation="{{ $annotation['#rotation']['#x'] }} {{ $annotation['#rotation']['#y'] }} {{ $annotation['#rotation']['#z'] }}">
Expand Down

0 comments on commit 9601103

Please sign in to comment.