aframe

Why does my OBJ / MTL model material show up as black?

橙三吉。 提交于 2019-12-20 01:58:16
问题 Why does my OBJ model have has no material and display as black? I have an OBJ: <a-obj-model id="gorilla" src="#gorilla-obj" mtl="#gorilla-mtl"></a-obj-model> I can see the geometry, but the material shows up as black. 回答1: If you check your MTL, you might notice it is trying to use TGA or some other sort of textures that aren't plain images. In this case, you need to include additional three.js loaders. You could try including all the necessary loaders like including https://github.com

How to listen to camera's world position in A-Frame?

半城伤御伤魂 提交于 2019-12-18 16:08:53
问题 How can I get the current position of a camera? Such that I can rotate my sky entity. Assume I have: <a-scene> <a-camera id="camera></a-camera> <a-sky id="mySky"></a-sky> </a-scene> 回答1: To get the position of the camera: var pos = document.querySelector('#camera').getAttribute('position'); To get the world position of the camera, we can convert the local position of the camera: var cameraEl = document.querySelector('#camera'); var worldPos = new THREE.Vector3(); worldPos

Aframe, VR website, unable to turn left right using android phone

こ雲淡風輕ζ 提交于 2019-12-18 09:27:13
问题 I have been working on this VR website for my project for sometime. It used to be able to allow user to view left/right side of the virtual world by moving your phone to the left/right. However, just recently, it suddenly did not work for android phone. I have tested on iphone/ipad, still works as per normal. But for some reason, i tried using note8 , s7 it doesnt work anymore. Would really appreciate if you can identify whats the problem, and how can I fix it? Thank you very much. 回答1: Try

DAE files image texture doesn't show up in Aframe when exported from Maya

≡放荡痞女 提交于 2019-12-17 14:24:21
问题 I've exported an .dae file with an image texture from Maya. But when that .dae file is used with Aframe, the image texture does not appear, and you can only see the base material. What exporter can I use with Maya that will fix this problem? Below is the same .dae file in PSD, and Aframe: UPDATE: Injecting the model as a Threejs.json via a script works, but kinda defeat the purpose of using AFrame. Screenshot 回答1: I presume You added Your collada ( dae ) model like presented on the aframe

Aframe angular 7 unable to load gltf model

白昼怎懂夜的黑 提交于 2019-12-16 18:06:10
问题 I am trying to display a gltf-model in Aframe using Angular 7. `<a-scene embedded="" cursor="rayOrigin: mouse"> <a-assets> <a-asset-item id="bedroom" src="../../assets/models/homedesign/scene.gltf"></a-asset-item> </a-assets> <a-entity id="camera" camera="" position="0 0 0" look-controls wasd-controls> </a-entity> <a-entity id="room" gltf-model="#bedroom" position="-14 -30 -125" rotation= "0 160 0" material-map="map: map"> </a-entity> </a-scene> ` But the model is not displayed and I see the

A-Frame - playing / pausing sound with a custom ('a-sound') source

浪子不回头ぞ 提交于 2019-12-14 02:09:07
问题 Edit 2: Here is the working code. Many thanks to Piotr for his help I couldn't have done it so effortlessly without you guys. sceneEl.querySelector('a-sound').setAttribute('sound', {src:url3}); let playing = false; var el = document.querySelector('a-box'); let audioEl = document.querySelector("a-sound"); var audio = audioEl.components.sound; el.addEventListener('click', () => { if (!playing) { audio.playSound(); } else { audio.stopSound(); } playing = !playing; }) } ); request.send( null ); }

How to load 3D object at runtime in aframe?

强颜欢笑 提交于 2019-12-13 17:09:39
问题 I am working on an aframe project where runtime loading of 3D object is required. I have read A-Frame documentations, and aframe doesn't seem to support runtime assets loading at all. I discovered this aframe-asset-on-demand-component by protyze (https://github.com/protyze/aframe-asset-on-demand-component) and it seems to allow runtime loading of img, audio and video. But its documentation does not indicate the possibility of loading 3D objects like files in .obj or .dae at runtime. Has

Change image of sky every few seconds with an animation

二次信任 提交于 2019-12-13 03:59:57
问题 I need change the image of sky every few seconds with an animation. like this. But without the event click, in my case, i need the change of picture with time. <a-assets> <img id="water" src="./3D/letras/Agua.jpg"/> <img id="air" src="./3D/letras/Aire.jpg"/> <img id="horizont" src="./3D/letras/Horizonte.jpg"/> <img id="hector" src="./3D/letras/hecxtor.jpg"/> </a-assets> 回答1: How about this. You make two animations: a fade-in, and a fade-out: <a-sky foo> <a-animation id="fadein-animation"></a

Aframe move vr-camera-component

妖精的绣舞 提交于 2019-12-13 03:50:04
问题 I move my camera when i trigger an event and it works perfectly on pc but not when im on my phone in the vr-mode. Need to fix this here some code: <a-entity id="camentity" rotation="0 90 0"> <a-camera id="cam" user-height="0" wasd-controls-enabled="false" look-controls> <a-animation attribute="position" begin="movecam_1" duration="500" from="0 0 0" to="-40 0 -50"></a-animation> <a-animation attribute="position" begin="movecam_1_bc" duration="500" from="-40 0 -50" to="0 0 0"></a-animation> </a

Why is my model not loading with A-Frame?

泪湿孤枕 提交于 2019-12-13 02:36:40
问题 I have a COLLADA, OBJ/MTL, etc model in A-Frame with <a-collada-model> or <a-obj-model> . When I add it to the scene, I don't see anything. What is going on? 回答1: Use a Webserver: Make sure you are using a local webserver or hosted webserver with CORS with correct mime types. Rather than trying to use filesystem. Check for CORS : If you are loading the asset from a different domain, you will need cross-origin resource sharing (CORS) headers set on the asset. For some options, all resources