 # Quaterion selective rotation

Hello,

I’m working on a game, and I found some trouble with World Editor - rotation of obiects. Only rotating of vector works and dunno how to implement rotating around that vector of obiect.

_rv is _rv - rotation angle , _rv[1…3] - vector of quaternion
cx - cy is how much we want to rotate ( in radians )

``````
if( i == 0 && rv ){ //rotacja pochylenia
Vector3f vec = RotateVector3f( _rv, _rv, _rv , cx - cy );
vec . normalize();
quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 );
quat . normalize();
} else
if( i == 1 && rv ){ // Rotation via OZ axis ony .. ???
Vector3f vec( _rv, _rv, _rv );
vec . normalize();
quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 ); //( RotationQuaternion( vec , cy - cx ) * RotationQuaternion( kXaxis , (float)M_PI_2 ) ) * RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 );
quat . normalize();
} else
if( i == 2 && rv ){ // stopie&#324; nachylenia
Vector3f vec( _rv, _rv, _rv );
vec . normalize();
quat = RotationQuaternion( vec , _rv[ 0 ] * Pidiv180 + ( cx - cy ) );
quat . normalize();
}

``````

Image to ilustrate: X - Blue ( i == 0 )
Y - Green ( i == 1 ) ?? We are looking it ??
Z - Red ( i == 2 )

Rotating X we rotate also Z one. If someone has an idea how to compute the Y one, please write. Thanks.

[ SOLVED ]

``````

Matrix4x4f matrix; // obrót obiektu wzgl&#281;dem nachylenie .. ???

glPushMatrix();