use raycaster over aabb-collider for saber collisions

This commit is contained in:
Kevin Ngo
2018-11-04 19:28:10 +08:00
parent 0139133dc3
commit 36b7032418
7 changed files with 45 additions and 33 deletions

View File

@@ -5,6 +5,10 @@
AFRAME.registerComponent('cursor-laser', {
dependencies: ['geometry'],
schema: {
enabled: {default: true}
},
init: function () {
const el = this.el;
const box = new THREE.Box3();
@@ -21,9 +25,15 @@ AFRAME.registerComponent('cursor-laser', {
this.currentLength = size.y;
},
update: function () {
this.el.object3D.visible = this.data.enabled;
},
tick: function () {
const el = this.el;
if (!this.data.enabled) { return; }
const cursor = el.parentNode.components.cursor;
if (!cursor) { return; }