Skip to content

Commit

Permalink
updated look-at component; bug fix: make look-at work with orbit cont…
Browse files Browse the repository at this point in the history
…rols
  • Loading branch information
weddingdj committed Jul 5, 2019
1 parent cdb956c commit 1b9303b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 147 deletions.
11 changes: 10 additions & 1 deletion js/isvr-model-center.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ AFRAME.registerComponent('isvr-model-center', {

init: function() {

var self = this;

var offset = this.data.offset;

var mdl = document.querySelector('#model');

var camera = document.querySelector('a-entity[camera]');

if (mdl) {

mdl.addEventListener('model-loaded', function() {

var camera = document.querySelector('a-entity[camera]');
var model = document.querySelector('#model');

var camera_wrapper = document.querySelector('#camera-wrapper');
Expand Down Expand Up @@ -56,6 +59,12 @@ AFRAME.registerComponent('isvr-model-center', {

},


tick: function () {

document.querySelector('#look-at').object3D.position.copy(document.querySelector('a-entity[camera]').getObject3D('camera').position);
}

});


143 changes: 0 additions & 143 deletions js/kframe/aframe-look-at-component.js

This file was deleted.

1 change: 0 additions & 1 deletion js/kframe/aframe-look-at-component.min.js

This file was deleted.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions js/superframe/aframe-look-at-component.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script src="{{ url($theme_dir . '/js/aframe-html-shader-component/aframe-html-shader.min.js') }}"></script>
<script src="{{ url($theme_dir . '/js/aframe-extras/aframe-extras.loaders.min.js') }}"></script>
<script src="{{ url($theme_dir . '/js/aframe-orbit-controls/aframe-orbit-controls.min.js') }}"></script>
<script src="{{ url($theme_dir . '/js/kframe/aframe-look-at-component.min.js') }}"></script>
<script src="{{ url($theme_dir . '/js/superframe/aframe-look-at-component.min.js') }}"></script>
<script src="{{ url($theme_dir . '/js/isvr-vr-mode.js') }}"></script>
<script src="{{ url($theme_dir . '/js/isvr-model-center.js') }}"></script>
</head>
Expand Down
5 changes: 4 additions & 1 deletion views/scene.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class="ply-model"
@endif


<a-entity id="look-at"></a-entity>


@if (isset($content['model'][0]['attach-annotations']))

<a-entity
Expand All @@ -113,7 +116,7 @@ class="ply-model"
@endphp

<a-entity
look-at="#camera"
look-at="#look-at"
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 1b9303b

Please sign in to comment.