Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate virtual object around the Y axis to face the device's Camera #1852

Open
itanbp opened this issue Apr 24, 2018 · 3 comments
Open

Rotate virtual object around the Y axis to face the device's Camera #1852

itanbp opened this issue Apr 24, 2018 · 3 comments
Labels

Comments

@itanbp
Copy link

itanbp commented Apr 24, 2018

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!

@thomasflynn
Copy link

@sushantojal can help you with billboards. sushant, care to give a quick example of how to use it?

@sushantojal
Copy link
Contributor

sushantojal commented Apr 24, 2018

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)));

@itanbp
Copy link
Author

itanbp commented Apr 25, 2018

@sushantojal @thomasflynn thanks.
Your support is truly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants