aframe

Is there a way to recenter / reset orientation?

核能气质少年 提交于 2019-12-24 10:58:18
问题 I just wanted to know if there is a buit-in function to reset head rotation. Most VR SDKs I've seen (Oculus, Carboard, etc) have a way to make current rotation the default forward rotation. Is there a simple way to do this in a-frame? 回答1: You can add a wrapper entity around the camera, and on an event, set the entity wrapper's rotation about the Y-axis to be negative the camera's rotation about the Y-axis. Here's an example (but in React) using shake.js by @jhsu: import React from 'react';

In A-Frame: How do I get the VR camera

荒凉一梦 提交于 2019-12-24 10:49:13
问题 In this example: https://glitch.com/~query-aframe-cameras I have registered a component which launches a projectile in the direction the user is looking (with a little boost for elevation) Spacebar or Screen Tap to launch - be sure to be looking above the horizon! It fails in mobile vr (stereo camera) mode: Projectiles continue to fire, but from the default orientation of the mono, not the stereo camera I'm using: var cam = document.querySelector('a-scene').camera.el.object3D; var camVec =

How do I delay/defer/control when an A-Frame scene initializes/loads?

岁酱吖の 提交于 2019-12-24 10:06:37
问题 I want to have an A-Frame scene start loading only when I tell it to. Currently if I put <a-scene> in an HTML file, it will start initializing immediately. <a-scene></a-scene> 回答1: An A-Frame scene waits for all of its children to initialize before it itself initializes. So it waits for every <a-entity> from the bottom up. Under the hood, <a-entity> is based on <a-node> which handles load order. When <a-node> emits loaded , then the parent nodes can begin loading. <a-entity> emits loaded when

Aframe: size of model

核能气质少年 提交于 2019-12-24 09:11:50
问题 When using a model as a source to an entity, say gltf, is there a way we know the original size? Since the scale attribute works on relative size, it seems to be a trial an error to fit the model to our desired size. I tried using the geometry.getComputingBox() of the mesh of the model but it returns null. Wondering if there is a component that is available that lets us specify the scale in absolute terms. 回答1: (This would have come as a comment but as I don't have enough rep points this is

How to move around with A-Frame using Google Cardboard's button?

陌路散爱 提交于 2019-12-24 08:46:44
问题 I am writing a WebVR application using A-Frame. The app is mostly tailored to Cardboard users. On the desktop, you can simply add the wasd-controls component to the camera in order to move around using WASD. However, I would like to be able to move the same way, only using the Cardboard button (i.e. a screen touch) instead, where the direction is determined by the camera's orientation. Is there a straightforward way of doing this with A-Frame? 回答1: As you point out, wasd-controls is really

AFRAME screen to world position

只谈情不闲聊 提交于 2019-12-24 08:21:59
问题 I'm trying to convert Mouse position to world coordinates in Three via Aframe Using something like let mouse = new three.Vector2() let camera = document.querySelector('#camera') let rect = document.querySelector('#sceneContainer').getBoundingClientRect() mouse.x = ( (event.clientX - rect.left) / rect.width ) * 2 - 1 mouse.y = - ( (event.clientY - rect.top) / rect.height ) * 2 + 1 let vector = new three.Vector3( mouse.x, mouse.y, -1 ).unproject( camera ) However it doesn't seem to be able to

gltf file not showing in Aframe

随声附和 提交于 2019-12-24 06:53:03
问题 I have two files, an glTF and OBJ file. I'm using Glitch to develop and I uploaded both of them to my assets folder. When I read my marker, only the OBJ file is displayed. <!DOCTYPE html> <html> <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script> <script src="https://raw.githack.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js"></script> <script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script> <body style=

gltf file not showing in Aframe

天大地大妈咪最大 提交于 2019-12-24 06:51:04
问题 I have two files, an glTF and OBJ file. I'm using Glitch to develop and I uploaded both of them to my assets folder. When I read my marker, only the OBJ file is displayed. <!DOCTYPE html> <html> <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script> <script src="https://raw.githack.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js"></script> <script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script> <body style=

Aframe envMap not applying to first primitive

我与影子孤独终老i 提交于 2019-12-24 06:49:32
问题 A cubic envMap seems to skip the first object it's applied to. Subsequent objects referencing the same map are fine. Reordering the objects in the HTML still results in which ever is first being skipped. Reordering in space has no effect. https://github.com/scottmsinger/aframe/tree/master/tests/env_map_order 回答1: Your cubemap tag is missing a close tag. That might be messing with the interpretation of the nextmost tag, causing the issue. <a-assets> <a-cubemap id="sky"> ... </a-cubemap> <--

A-Frame : How to open a dynamically created a-link in a _blank page

微笑、不失礼 提交于 2019-12-24 00:55:00
问题 this is specific to A-Frame. I'm creating an a-link from javascript code: var alinkEl = document.createElement('a-link'); alinkEl.setAttribute('href', 'http://www.facebook.com/share.php?u=https://.../' + folder + fileName); This does not work: alinkEl.setAttribute('target', '_blank'); Any hint? 回答1: The <a-link> s are intended for link traversal as far as i know, not for opening new tabs. The component does not have a target attribute in the schema. Furthermore, the navigation is implemented