Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARcore : how to rotate an object around its Y axis?

I wonder how to rotate an object around its Y axis.

For example, I would like to rotate the droid bot of the Google sample app hello_ar_java https://github.com/google-ar/arcore-android-sdk/tree/master/samples/hello_ar_java around its Y axis with an angle alpha.

like image 386
Regis_AG Avatar asked Feb 22 '18 09:02

Regis_AG


1 Answers

I recently had to do something similar. In the object renderer's draw method you can add:

    Matrix.translateM(mModelMatrix, 0, x, y, z);
    Matrix.rotateM(mModelMatrix, 0, rotationAngle, 0f, 1f, 0f);
    Matrix.translateM(mModelMatrix, 0, -x, -y, -z);
like image 112
ahomphophone Avatar answered Sep 17 '22 13:09

ahomphophone