Search code examples
javascriptthree.jsaframe

Aframe Billboarding Only Y Axis


I'm using this component to have an image always face the camera in an Aframe scene. It works fine but i need to make the billboarding only work on the Y axis, imagine the image is a person and the person should only be turning around to follow the camera, not lay back looking up as the camera moves closer.

Any idea how to modify that component to achieve that?


Solution

  • managed by setting the Y coordinate of the target to the same as the object billboarding:

    this.vector.y = object3D.position.y;  //this line is new
    return object3D.lookAt(this.vector);