From 57b79adb98614debb32fb4b37d9ee1133c742b51 Mon Sep 17 00:00:00 2001 From: "Glitch (poetic-aframe)" Date: Tue, 4 Aug 2020 11:12:27 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8F=A6=F0=9F=9B=AC=20Updated=20with?= =?UTF-8?q?=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- components/a-items.js | 4 ++-- components/a-locomotion.js | 15 ++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6802d06..97a2825 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ A-Frame components and stuff made by poeticAndroid! =================================================== - - [a-locomotion.md](https://glitch.com/edit/#!/poetic-aframe?path=components%2Fa-locomotion.md%3A1%3A0) - - [a-items.md](https://glitch.com/edit/#!/poetic-aframe?path=components%2Fa-items.md%3A1%3A0) + - [a-locomotion.md](https://github.com/poeticAndroid/poetic-aframe/blob/master/components/a-locomotion.md) + - [a-items.md](https://github.com/poeticAndroid/poetic-aframe/blob/master/components/a-items.md) \ No newline at end of file diff --git a/components/a-items.js b/components/a-items.js index 357f9ed..4e34640 100644 --- a/components/a-items.js +++ b/components/a-items.js @@ -63,8 +63,8 @@ this._leftHand.addEventListener("buttonchanged", this.enableHands) this._rightHand.addEventListener("buttonchanged", this.enableHands) this._leftHand.addEventListener("gripdown", this.leftGrab) - this._leftHand.addEventListener("usedown", this.leftUseDown) - this._leftHand.addEventListener("useup", this.leftUseUp) + this._leftHand.addEventListener("triggerdown", this.leftUseDown) + this._leftHand.addEventListener("triggerup", this.leftUseUp) this._leftHand.addEventListener("gripup", this.leftDrop) this._rightHand.addEventListener("gripdown", this.rightGrab) this._rightHand.addEventListener("triggerdown", this.rightUseDown) diff --git a/components/a-locomotion.js b/components/a-locomotion.js index 461ebc5..6fb0c53 100644 --- a/components/a-locomotion.js +++ b/components/a-locomotion.js @@ -106,6 +106,7 @@ this._cameraObj.object3D.getWorldDirection(this.cameraDir) this.el.object3D.getWorldPosition(this.playCenter) this.playerPos.set(this.cameraPos.x, this.playCenter.y - this.floorOffset, this.cameraPos.z) + if (this.cameraPos.y < this.playerPos.y) this.toggleCrouch() delta.set(this.safePos.x - this.playerPos.x, this.safePos.y - this.playerPos.y, this.safePos.z - this.playerPos.z) this._bumper.object3D.position.copy(delta) @@ -268,12 +269,16 @@ enableHands: function() { let _cursor = this._camera.querySelector("a-cursor") if (_cursor) { - this._cursor.flushToDOM(true) - let cursor = this._cursor.cloneNode(true) - this._rightHand.appendChild(cursor) this._camera.removeChild(_cursor) - this._cursor = cursor + + this._cursor = this._rightHand.ensure("a-cursor.locomotion", "a-cursor", { + autoRefresh: false, + class: "locomotion", + objects: "[floor], [wall]", + position: { x: 0, y: 0, z: 0 } + }) this._cursorBall = this._cursor.ensure("a-sphere", "a-sphere", { radius: 0.0625, color: "#0ff", visible: false }) + this._rightHand.removeEventListener("buttonchanged", this.enableHands) this.hasHands = true console.log("Hands are enabled!") @@ -284,7 +289,7 @@ if (this.floorOffset) { this.floorOffset = 0 this._vehicle.object3D.position.y = 0.5 - this.moveTo(this.playerPos.x, this.playerPos.y + .6, this.playerPos.z) + this.moveTo(this.playerPos.x, this.playerPos.y + 1, this.playerPos.z) } else { this.floorOffset = -1 this._vehicle.object3D.position.y = 0.5 - this.floorOffset From 09483100558e51c14e5d6e7b17280bd3ec5009ff Mon Sep 17 00:00:00 2001 From: "Glitch (poetic-aframe)" Date: Tue, 4 Aug 2020 14:01:51 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=8C=F0=9F=8D=8F=20Updated=20with?= =?UTF-8?q?=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit