Skip to content
Snippets Groups Projects
Commit 375bae1d authored by Robert Long's avatar Robert Long
Browse files

Added hand-controls-child-visibility component and network schema.

parent e06bcc73
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<head> <head>
<title>A-Frame Social VR Demo</title> <title>A-Frame Social VR Demo</title>
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script> <script src="https://aframe.io/releases/0.7.0/aframe.js"></script>
<script src="./app.bundle.js"></script> <script src="./app.bundle.js"></script>
</head> </head>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<a-entity id="nametag" networked="template:#nametag-template;showLocalTemplate:false;"></a-entity> <a-entity id="nametag" networked="template:#nametag-template;showLocalTemplate:false;"></a-entity>
<a-entity id="left-hand" hand-controls="left" axis-dpad="centerZone: 1" teleport-controls="cameraRig: #player-rig; teleportOrigin: #head; button: action_teleport_" <a-entity id="left-hand" hand-controls="left" visible="false" hand-controls-child-visibility axis-dpad="centerZone: 1" teleport-controls="cameraRig: #player-rig; teleportOrigin: #head; button: action_teleport_"
networked="template:#hand-template;showLocalTemplate:false;"> networked="template:#hand-template;showLocalTemplate:false;">
<a-entity id="watch" gltf-model="assets/hud/watch.gltf" position="0 0.0015 0.147" rotation="3.5 0 0"> <a-entity id="watch" gltf-model="assets/hud/watch.gltf" position="0 0.0015 0.147" rotation="3.5 0 0">
<a-circle mute-state-indicator scale-audio-feedback="analyserSrc: #head; minScale: 0.035; maxScale: 0.08;" position="0 0.023 0" <a-circle mute-state-indicator scale-audio-feedback="analyserSrc: #head; minScale: 0.035; maxScale: 0.08;" position="0 0.023 0"
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</a-entity> </a-entity>
</a-entity> </a-entity>
<a-entity id="right-hand" hand-controls="right" axis-dpad teleport-controls="cameraRig: #player-rig; teleportOrigin: #head; hitEntity: #telepor-indicator; button: action_teleport_;" <a-entity id="right-hand" hand-controls="right" visible="false" hand-controls-child-visibility axis-dpad teleport-controls="cameraRig: #player-rig; teleportOrigin: #head; hitEntity: #telepor-indicator; button: action_teleport_;"
networked="template:#hand-template;showLocalTemplate:false;"></a-entity> networked="template:#hand-template;showLocalTemplate:false;"></a-entity>
</a-entity> </a-entity>
......
AFRAME.registerComponent("hand-controls-child-visibility", {
init() {
this.onControllerConnected = this.onControllerConnected.bind(this);
this.onControllerDisconnected = this.onControllerDisconnected.bind(this);
this.el.addEventListener("controllerconnected", this.onControllerConnected);
this.el.addEventListener(
"controllerdisconnected",
this.onControllerDisconnected
);
this.el.setAttribute("visible", false);
},
onControllerConnected() {
this.el.setAttribute("visible", true);
},
onControllerDisconnected() {
this.el.setAttribute("visible", false);
}
});
...@@ -10,6 +10,7 @@ import "./components/audio-feedback"; ...@@ -10,6 +10,7 @@ import "./components/audio-feedback";
import "./components/nametag-transform"; import "./components/nametag-transform";
import "./components/avatar-customization"; import "./components/avatar-customization";
import "./components/mute-state-indicator"; import "./components/mute-state-indicator";
import "./components/hand-controls-child-visibility";
import { generateName } from "./utils"; import { generateName } from "./utils";
...@@ -24,6 +25,11 @@ NAF.schemas.add({ ...@@ -24,6 +25,11 @@ NAF.schemas.add({
] ]
}); });
NAF.schemas.add({
template: "#hand-template",
components: ["position", "rotation", "visible"]
});
AFRAME.registerInputMappings({ AFRAME.registerInputMappings({
default: { default: {
common: { common: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment