2011-12-02 92 views
1

我想模擬胸部開口,胸部開口由2個主要部分組成,即蓋子和底座。在固定點上旋轉OpenGL

爲了在x軸上旋轉,是否需要將蓋子移動到原點,以便:a)蓋子的任何角落位於(0,0,0)或; b)蓋子的中心必須在原點上?

所以我的代碼如下所示:

- draw the chest base 
- translate to origin 
- rotate 
- translate to original position 
- draw the lid 

回答

4

您應位置的蓋子,以便它的支點是在原點。 樞軸點是它旋轉的點,在這種情況下,它將是你的蓋子的鉸鏈。

至於你的代碼的順序:

- draw the chest base 
- translate so pivot point of lid is on origin 
- rotate 
- draw the lid 
- translate and rotate to original position