Closed omgitsraven closed 7 years ago
Looks good!
BTW, if there's a way to get a function called whenever an object is about to be drawn (i.e. twice per frame in VR mode) ...
What you want is:
el.object3D.onBeforeRender = function ( renderer, scene, camera ) {
// update things here
};
^I think this was added after three.js r84, in which case you'd need to be on A-Frame master branch (i.e. the work-in-progress toward 0.7.0).
Thanks for the tip—I'd totally missed that being added to three.js, that's exactly what I needed :) And it turns out it's been in since r82, which goes back to before Aframe 0.4.0 even! Looks like I might be doing a quick rewrite :)
Thanks!
This one's for a bit more of a technical crowd than my last component, but it's much simpler and is already basically stable as far as I can tell.
BTW, if there's a way to get a function called whenever an object is about to be drawn (i.e. twice per frame in VR mode), let me know and I'll take the camera matrix inverse thing out of the vertex shader and into javascript, would just make it that much simpler/shorter...