A-frame set gltf to look at camera angle

  aframe, html, javascript, virtual-reality, webvr

I am wondering how it would be possible in A-frame to rotate a gltf model constantly so it’s always facing the position I’m looking at. for example. If I’m looking straight ahead at 0 degrees, the gltf is also pointing at 0 degrees. If I turn the camera to face 90 degrees, the gltf turns to 9 degrees. I’ve already tried creating a variable and setting the camera angle to that variable and setting the rotation property to the variable but been able to figure out how to capture the camera angle as a variable and set the rotation property of gltf to the variable. Ideally, I would want to figure out how I can create something like this:

<script>
var rotate;
var rotate = camera angle;
</script>
<a-gltf-model src="" position="0 0 0" rotation="var rotate" scale="0.1 0.1 0.1"></a-gltf-model>

Does anybody know how to accomplish this?

Source: Ask Javascript Questions

LEAVE A COMMENT