opengl-es - 核心 : how to rotate an object around its Y axis?

标签 opengl-es opengl-es-2.0 augmented-reality arcore

我想知道如何围绕其 Y 轴旋转对象。

例如,我想旋转 Google 示例应用程序 hello_ar_java https://github.com/google-ar/arcore-android-sdk/tree/master/samples/hello_ar_java 的 droid bot围绕其 Y 轴,角度为 alpha。

最佳答案

我最近不得不做类似的事情。在对象渲染器的 draw 方法中,您可以添加:

    Matrix.translateM(mModelMatrix, 0, x, y, z);
    Matrix.rotateM(mModelMatrix, 0, rotationAngle, 0f, 1f, 0f);
    Matrix.translateM(mModelMatrix, 0, -x, -y, -z);

关于opengl-es - 核心 : how to rotate an object around its Y axis?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48923898/

相关文章:

java - 使用 SpriteBatch 时的 LibGDX 模板缓冲区

javascript - WebGL:如何将值绑定(bind)到 mat4 属性?

java - 使用数组而不是缓冲区加载 Android OpenGL ES 2.0 纹理

java - Android OpenGL ES 2.0 多个对象

swift - 我无法在加载的 SceneKit 模型中移动

ios - ARKit 平面检测 - 类型 'ARView' 的值没有成员 'session'

Android OpenGL 只渲染一半的屏幕

ios - Opengl ES 着色器 - 获取属性

java - OpenGL ES2.0 火焰作品(包括加载模型)

c# - Hololens 2 轻击和头部移动在 Unity 中有效,但在 HoloLens 上无效