7

我有一个 3D 模型(OpenGL ES 1.1 iPhone SDK v3.0),它有点复杂(即数千个顶点和面),我想在模型中心或附近围绕 Y 轴旋转这个模型。问题是 glRotate 将我的模型围绕其底部边缘之一的中心/附近的一个点旋转,而不是靠近Model 的中心。想象一辆汽车绕着灯柱绕着很近的圈子行驶,这基本上就是我所拥有的。我希望汽车被刺穿在灯柱上并围绕它旋转。(下面的一些来源)

   // BLUE BLOCK----------------------------------------------
    glPushMatrix();
    {
        glTranslatef(blueLocation[0], blueLocation[1], blueLocation[2]);
        glRotatef(blueRotAngle, 0.0, 0.0, 1.0);
        ...

问题:
有没有一种简单的方法可以改变 OpenGL 中的旋转中心?

4

3 回答 3

12

当然。向下平移对象。然后旋转它。

于 2009-07-15T10:12:23.360 回答
2

值得记住的是,OpenGL 中的所有操作都是相对于原点进行的。您不能“更改 OpenGL 中的旋转中心”。您相对于该原点移动世界。

于 2009-07-19T01:10:44.353 回答
1

You should use your model API to change the model origin. If you could tell which one you're using, maybe I could help some more.

If you have access to software that can edit your model, you can fix that directly in the model file and remove any hacks from your code.

于 2009-07-15T10:35:39.863 回答