OpenGL Transformation (Object Space / World Space)
Verfasst: 27.04.2010, 08:25
Hallo zusammen,
ich arbeite gerade an einem iPhone App und habe eine Wissenlücke.
Derzeit rotiere ich ein Object im lokalen Object Space so (Funktioniert auch).
Nun möchte ich das Object aber im WorldSpace Rotieren lassen. Allerdings so das dass Objekt danach noch an der selben stelle steht.
Ich weiss gerade nicht was ich dafür machen muss. Kann mir hier jemand helfen ?
Gab es hier nicht mal Tutorials darüber ?
Danke und Grüße
Matthias
ich arbeite gerade an einem iPhone App und habe eine Wissenlücke.
Derzeit rotiere ich ein Object im lokalen Object Space so (Funktioniert auch).
Code: Alles auswählen
-(void)addRotation:(float)x:(float)y:(float)z
{
float xx = matrix[_41];
float yy = matrix[_42];
float zz = matrix[_43];
matrix[_41]=0;
matrix[_42]=0;
matrix[_43]=0;
static Matrix3D rotationMatrix;
if (x!=0)
{
Matrix3DSetIdentity(rotationMatrix);
Matrix3DSetXRotationUsingRadians(rotationMatrix,x);
Matrix3DMultiply(matrix,rotationMatrix,matrix);
}
if (y!=0)
{
Matrix3DSetIdentity(rotationMatrix);
Matrix3DSetYRotationUsingRadians(rotationMatrix,y);
Matrix3DMultiply(matrix,rotationMatrix,matrix);
}
if (z!=0)
{
Matrix3DSetIdentity(rotationMatrix);
Matrix3DSetZRotationUsingRadians(rotationMatrix,z);
Matrix3DMultiply(matrix,rotationMatrix,matrix);
}
matrix[_41] = xx;
matrix[_42] = yy;
matrix[_43] = zz;
}
Ich weiss gerade nicht was ich dafür machen muss. Kann mir hier jemand helfen ?
Gab es hier nicht mal Tutorials darüber ?
Danke und Grüße
Matthias