supermedium / aframe-react

:atom: Build virtual reality experiences with A-Frame and React.
https://ngokevin.github.io/aframe-react-boilerplate/
MIT License
1.42k stars 151 forks source link

Use of the asset management system within aframe-react? #32

Closed sdras closed 8 years ago

sdras commented 8 years ago

It's unclear to me how we use the asset management system- when combining these two abstractions. Like in here, for example, we're using a reference id- if we were using React, seems like we'd want the a-assets to be its own component. https://github.com/aframevr/aframe/blob/master/examples/boilerplate/360-video/index.html

sdras commented 8 years ago

Thanks in advance for any assistance.

ngokevin commented 8 years ago

Hi. What would the benefit or use case of wrapping <a-assets> in a component be? In the case of scenes and entities, we wrap them to provide serialization between props and A-Frame component strings.

sdras commented 8 years ago

I don't see any particular use case for wrapping <a-assets> aside from that's consistently what all of their documentation suggests. Do you have an example of what you would do for an entity with a url src in this case? I don't see any documentation for it, but would appreciate an example.

RSpace commented 8 years ago

Hi Sarah.

I like to wrap the assets in their own component for smaller projects. You can see see an example here: https://github.com/RSpace/agile-space/blob/master/src/js/components/Assets.js

I include this component as the first thing within the scene element, for example: https://github.com/RSpace/agile-space/blob/master/src/js/containers/Root.js#L23

Hope this helps.

ngokevin commented 8 years ago

https://aframe.io/docs/0.3.0/core/asset-management-system.html details <a-assets>. I don't think there is any documentation suggesting wrapping <a-assets> in a React Component.

ngokevin commented 8 years ago

But yeah, what you can do what @RSpace did if you want to separate it out.

luatnd commented 7 years ago

@sdras The same to me, I have an implementation here: https://www.npmjs.com/package/aframe-react-assets

It's not a good plugin but very easy to use with React.

sdras commented 7 years ago

thanks @luatnd!