aframe

Continuously moving Aframe camera into direction of view

半城伤御伤魂 提交于 2019-11-29 12:57:18
I want to continuously move the view of my Aframe scene in the current viewing direction. There seem to be two components to do this, (1) getting current viewing direction in correct format, (2) defining and updating a continuous animation with the current viewing direction of the camera. I managed to get the camera's viewing direction using the following code: <script> AFRAME.registerComponent('listener', { tick: function () { var position = this.el.getAttribute('position'); var rotation = this.el.getAttribute('rotation'); } }); </script> How can I create an animation that moves in the camera

How to detect Desktop vs. Mobile vs. GearVR vs. Oculus Rift vs. Vive in A-Frame?

荒凉一梦 提交于 2019-11-29 12:51:11
问题 In A-Frame, I want to detect if the user has a VR headset connected and to tell which device they are using. How can I do this? Desktop (no VR display) Mobile (e.g., webvr-polyfilled Google Cardboard, iPhone, Android) Samsung GearVR Oculus Rift HTC Vive 回答1: There are several utility functions in A-Frame we can use to detect compatibility: https://aframe.io/docs/master/core/utils.html The mobile-related utils look at navigator.userAgent . The VR-related utils check to see if the pose data

Why is my video or videosphere not playing on mobile in A-Frame VR?

白昼怎懂夜的黑 提交于 2019-11-29 08:16:13
I have an A-Frame scene with a video or videosphere: <a-scene> <a-assets> <video id="video" src="anothervideo.mp4></video> </a-assets> <a-video src="myvideo.mp4></a-video> <a-videosphere src="#video></a-videosphere> </a-scene> When I test in iOS or Android, I just see a black screen. It works on desktop. Speaking of leveraging Enter VR button, try: <a-scene> <a-assets> <video id="video" src="anothervideo.mp4"></video> </a-assets> <a-video class="video" src="myvideo.mp4"></a-video> <a-videosphere class="video" src="#video></a-videosphere> </a-scene> <script> function playVideo () { var els =

How to detect when a marker is found in AR.js

你离开我真会死。 提交于 2019-11-28 12:33:33
I'm trying to detect when a marker if found/lost in ar.js, while using a-frame. From what I see in the source code , when the marker is found, a 'getMarker' event should be fired, moreover artoolkit seems to dispatch a markerFound event. I tried to listen to those events on the <a-scene> , or on the <a-marker> , but it seems I'm either mistaken, or i need to get deeper to the arController , or arToolkit objects. When i log the scene, or the marker, i only get references to the attributes, which don't seem to have the above objects attached.(like marker.arController , or marker.getAttribute(

Disable A-Frame inspector (for production)

孤人 提交于 2019-11-28 11:05:11
问题 Hello fellow AFrame developers, I would like to disable the inspector (Ctrl+Alt+I), for my production environment so the user can't open it and see the whole backstage of my game. Moreover, I'm sure that the size of my app will be significantly lower without this. I can see that the inspector is never disabled in all the examples I found online, so I'm wondering if this is even possible... This piece of documentation mentions this : "Not only can we open our local scenes inside the Inspector,

Can't import A-frame into component - Angular2

时光怂恿深爱的人放手 提交于 2019-11-28 10:17:12
问题 I have a project created with angular-cli where I have installed aframe via npm install aframe --save , and when I try to import it in the component via import 'aframe'; it causes the following error: Failed to execute registerElement on Document : Registration failed for type a-node . A type with that name is already registered. In this case, the only way to make it work is by importing the library in the <head> tag of the index.html file. Instead I would like to access aframe object3D to

Play sound on click in A-Frame

一笑奈何 提交于 2019-11-28 10:05:51
问题 So I'm struggling to find a solution to play/stop/pause sound on "click" i.e. when focusing with a black dot with A-Frame sound entity... What I would like to have is a plain, shape or whatever with a play/pause image on it, which would trigger audio when focused. Did anyone encounter something similar perhaps? <audio id="sound" crossorigin="anonymous" preload="auto" src="some-audio-file.mp3"></audio> ... would trigger something like sound="on: click; src: #sound" 回答1: try making a custom

How to detect when a scene is loaded in A-Frame?

这一生的挚爱 提交于 2019-11-28 07:59:29
问题 Is there some event that is triggered when A-Frame is fully loaded? Right now I’ve managed to get my document.querySelector(".a-enter-vr-button") working, but only after placing it inside a setTimeout function, which seems a bit of a makeshift solution. So if anyone has any way of making a js script fire after A-Frame has fully loaded please let me know! 回答1: You can use the loaded event: document.querySelector('a-scene').addEventListener('loaded', function () {...}) But we recommend using

Continuously moving Aframe camera into direction of view

☆樱花仙子☆ 提交于 2019-11-28 06:38:57
问题 I want to continuously move the view of my Aframe scene in the current viewing direction. There seem to be two components to do this, (1) getting current viewing direction in correct format, (2) defining and updating a continuous animation with the current viewing direction of the camera. I managed to get the camera's viewing direction using the following code: <script> AFRAME.registerComponent('listener', { tick: function () { var position = this.el.getAttribute('position'); var rotation =

Move camera in aframe with physics engine

时光怂恿深爱的人放手 提交于 2019-11-28 05:43:12
问题 I am using a physics engine in my aframe application, and I want the camera to move when the user clicks a button. I want to keep the physics engine properties so I am using applyImpulse as a method for motion. Here is my example scene: <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script> <script src="//cdn.rawgit.com/donmccurdy/aframe-extras/v2.3.0/dist/aframe-extras.min.js"></script> <a-scene physics> <!-- Camera --> <a-entity id="cameraWrapper" geometry="box" dynamic-body