aframe

how to reset camera position on enter VR?

倾然丶 夕夏残阳落幕 提交于 2019-12-06 11:08:58
How can I reset the camera position when the user clicks the enter VR button in an A-Frame scene? I set a nice camera position for desktop wasd-controls users, but want to reset the position and rotation when a Vive user enters VR. I followed the pattern of this answer to setup the camera initially: <!-- Player --> <a-entity id='cameraWrapper' position='1 1.8034 1' rotation='-35 40 0'> <a-entity camera look-controls wasd-controls="fly: true"></a-entity> </a-entity> and here I attempt to reset the position and rotation with the window.onvrdisplaypresentchange event from the WebVR API: // // if

Cannot assign to read only property 'detachedCallback' of object '#'

走远了吗. 提交于 2019-12-06 08:27:29
I installed A-Frame by npm install aframe --save. When I use: import 'aframe'; // or use: require 'aframe'; import { Component } from '@angular/core'; @Component({ selector: 'app', template: ` <a-scene></a-scene> ` }) export class AppComponent {} I got the error: zone.js:1046Uncaught TypeError: Cannot assign to read only property 'detachedCallback' of object '#' I checked this Angular_VRDemo , but still did not figure out myself. I guess it because aframe library doesn't implement some properties (like detachedCallback and other) by creation custom element. https://github.com/aframevr/aframe

Writing test specs for A-Frame

孤人 提交于 2019-12-06 07:42:10
I'm totally new to VR and am working on a Vr space shooter in AFrame for a class project and was wondering if there is any documentation/standards for TDD in AFrame. Could anyone point me in the right direction? Build your application almost entirely in A-Frame components: https://aframe.io/docs/0.4.0/guides/writing-a-component.html Then test the components. Just about every component in the A-Frame codebase has unit tests: https://github.com/aframevr/aframe/tree/master/tests/components The component template in angle also has a unit test setup. https://github.com/aframevr/angle/tree/master

Disable inspector

元气小坏坏 提交于 2019-12-06 04:59:21
问题 I'm trying to disable inspector on a simple A-Frame WebVR app with no success. Tried to use and also disabling key press Ctrl + Alt + I using JavaScript. But, inspector is still loading. Does anyone knows how to do that? My scene is really simple: <html> <head> <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> </head> <body> <a-scene> <a-assets><img id="render" src="back.png"></a-assets> <a-sky src="#render"></a-sky> </a-scene> </body> </html> 回答1: this should work for 0

How to embed an aframe scene into a div

别来无恙 提交于 2019-12-06 01:21:47
I am trying to embed a .OBJ model into an element so that it is confined to a specific width and height, instead of a full page canvas. I'm trying to replicate the "scene" embedded into the header of https://sketchfab.com/ . I would like the camera in my scene to pan round the central axis of the model(just like in the example). I'm having trouble accomplishing this... so far, I am able to successful load the following afame scene into my browser: <a-scene> <a-box color="#6173F4" width="4" height="10" depth="2"></a-box> </a-scene> But I can't get the scene to be resized and confined within a

How to change the pivot point, transform origin, or point of rotation for an object A-Frame?

泪湿孤枕 提交于 2019-12-06 01:20:50
问题 When I draw a <a-box> . The localization is in the center of the box. The rotation rotates about the center of the box. How do I change the point of rotation? <a-box rotation="0 45 0"></a-box> 回答1: One way is to wrap the object in a parent entity, offset the position of the inner entity, and then apply transformations to the parent entity. The code below will shift the point of rotation (or transform origin) on the Y-axis by 1 meter. <a-entity rotation="0 45 0"> <a-box position="0 1 0"></a

How can I hide an element with A-Frame?

坚强是说给别人听的谎言 提交于 2019-12-05 23:30:56
问题 What is the best way to hide an element using A-Frame? Do I need to remove the element from the DOM? 回答1: var el = document.querySelector("#yourElementId"); el.setAttribute("visible",false); 回答2: The easiest way to hide an element is the visible attribute: myElement.setAttribute("visible", false) 回答3: You can also specify it on the a-frame tag itself e.g.: <a-image id="hand-overview-chart" src="#handOverviewImg" position="3 3 0" width="4" height="4" visible="false"> </a-image> Of course you

a-frame vr how to drag and drop assets / elements insight a picture?

醉酒当歌 提交于 2019-12-05 21:38:41
I am trying out a-frame and can't find anything about how to drag and drop elements and have been looking for it for hours! Is anyone familiar with a-frame? Thanks thats my code so far: <a-scene> <a-cursor></a-cursor> <a-assets> <img id="enemy-sprite" crossorigin="" src="mustache1.jpg"> </a-assets> <a-image look-at="#player" src="#enemy-sprite" transparent="true" position="0 1.8 -4"></a-image> <a-camera id="player" position="0 1.8 0"></a-camera> <a-sky src="street.jpg"></a-sky> EDIT: browser/home.html: <scene scene-id="sceneId"></scene> browser/js/app/directives/screne.html: <a-scene> <a

How to mange memory used by A-Frame?

倖福魔咒の 提交于 2019-12-04 19:38:01
I'm building a web app which has 360 degree images loaded into an a-sky primitive. I'm using aframe-react . There are total of 20+ 360 degree images and only one img asset inside a-assets . once user switches scene react will change src of asset img and scene will re render. Everything works fine but it's using lot of memory because of caching. One time it used 4GB+ memory. In mobile the web page crashes after switching through ~8+ images. How do I handle this situation? I tried looking into THREE.Cache but images are not cached there. Is this memory usage has anything to do with using React?

AFrame: How to render a camera to a texture

萝らか妹 提交于 2019-12-04 05:27:37
问题 I'm trying to have a second camera to show a "from the sky" view of an AFrame scene. I've learned how to do it using a 2D canvas for rendering, following this example: But I wonder if this could be done without using a external <div> , something like rendering directly to some asset, or maybe directly to the texture... My current code is: <html> <head> <script src="//aframe.io/releases/0.8.2/aframe.min.js"></script> <script> // Original code: // https://wirewhiz.com/how-to-use-a-cameras