我试图通过角点而不是从中心旋转立方体。这是可能的还是我需要旋转然后重新定位它。我试图模拟手臂上下移动
// leg arm
glVertexAttrib4f(2,1, 1,0, self.color.a);
self.modelViewMatrix = GLKMatrix4MakeTranslation(self.position.x + 0.45,self.position.y + 0.1, self.position.z - 0.65);//(float)x, (float)y, -1.5f)
self.modelViewMatrix = GLKMatrix4Rotate(self.modelViewMatrix,self.leftArmRotation, 1.0 ,0.0 ,0.0);
self.modelViewMatrix = GLKMatrix4Scale(self.modelViewMatrix, 0.2, 0.2, 0.9);
self.modelViewMatrix = GLKMatrix4Multiply(eyeBaseModelViewMatrix, self.modelViewMatrix);
normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(self.modelViewMatrix), NULL);
modelViewProjectionMatrix = GLKMatrix4Multiply(self.projectionMatrix, self.modelViewMatrix);
glUniformMatrix4fv(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], 1, 0, modelViewProjectionMatrix.m);
glUniformMatrix3fv(uniforms[UNIFORM_NORMAL_MATRIX], 1, 0, normalMatrix.m);
glDrawArrays(GL_TRIANGLES, 0, 36);
// right arm
glVertexAttrib4f(2,1, 1,0, self.color.a);
self.modelViewMatrix = GLKMatrix4MakeTranslation(self.position.x - 0.45,self.position.y + 0.1, self.position.z - 0.65 );//(float)x, (float)y, -1.5f)
self.modelViewMatrix = GLKMatrix4Scale(self.modelViewMatrix, 0.2, 0.2, 0.9);
self.modelViewMatrix = GLKMatrix4Multiply(eyeBaseModelViewMatrix, self.modelViewMatrix);
normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(self.modelViewMatrix), NULL);
modelViewProjectionMatrix = GLKMatrix4Multiply(self.projectionMatrix, self.modelViewMatrix);
glUniformMatrix4fv(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], 1, 0, modelViewProjectionMatrix.m);
glUniformMatrix3fv(uniforms[UNIFORM_NORMAL_MATRIX], 1, 0, normalMatrix.m);
glDrawArrays(GL_TRIANGLES, 0, 36);