GearVRf
GearVRf copied to clipboard
Rotate virtual object around the Y axis to face the device's Camera
Hi,
I intending to use GearVRf for rendering the virtual objects in an ARCore
project.
I'm trying to make an anchored virtual object to always face the Camera, giving the user the feeling the virtual object is always looking at him.
following @thomasflynn suggestion, I thought to use GVRBillboard
.
I would appreciate any general direction for how this can be achieved. Thanks!
@sushantojal can help you with billboards. sushant, care to give a quick example of how to use it?
Hi @itanbp , GVRBillboards can be added as components to scene objects. Using it on a sceneobject is as simple as:
sceneObject.attachComponent(new GVRBillboard(gvrContext));
where sceneObject is a GVRSceneObject.
This will rotate the scene object about the Y axis, in such a way that it always faces the camera. You can even specify your custom vector in such a way that the object is only constrained to rotate around that vector while facing the camera. For example,
sceneObject.attachComponent(new GVRBillboard(gvrContext, new Vector3f(1.0f, 0.0f, 0.0f)));
@sushantojal @thomasflynn thanks. Your support is truly appreciated!