3 ms·
I was wondering if it’s possible to use A-frame without the HTML stuff so to speak. Can I sort of just hand meshes and a camera position directly to A-frame? I
by bringtheaction 9y ago
I was wondering if it’s possible to use A-frame without the HTML stuff so to speak. Can I sort of just hand meshes and a camera position directly to A-frame? I am writing a video game currently in “fake” 3D with JS and Canvas and once I have the gameplay mechanics down I intend to rewrite it with WebGL and I was wondering if A-frame could then give me the ability to let people experience my game in VR.
- danbolt 9y agoI'm not 100% sure, but looking at the documentation, you can manually use/tweak the three.js objects underneath A-Frame. [1] They seem to discourage it though, or, it seems like they'd rather you use the markup implementation. [1] https://aframe.io/docs/0.8.0/introduction/javascript-events-dom-apis.html#retrieving-position-and-scale https://aframe.io/docs/0.8.0/introduction/javascript-events-...
- ngokevin 9y agoActually, on the contrary, we prefer A-Frame be used as a framework over three.js, and not trying to abstract it. It's sort of a way to organize/encapsulate three.js code as a declarative ECS framework.
- ngokevin 9y agoYeah, document.querySelector('a-scene').scene provides you the three.js scene, you can dump whatever you want in there.
- kalkut 9y agoThe HTML stuff mainly abstracts Three.js objects for faster development and better composition. Since Three.js is already an abstraction of WebGL you may have more luck with it by making a threejs plugin that "hand meshes and a camera position" to the Three.js scene/geometries. But honestly my experience on this subject is that it would be much more manageable and productive to make the game directly with A-Frame or at least with threejs. If you need a particuliar behaviour you can go down from A-Frame to threejs and from threejs to WebGL and build the relevant components/plugins.