Hello.
I have a matrix with a rotation and a position that i converted to a
osg::Matrixf from a float[16] directly from trackdAPI. I set the position
some distance away from the scene (indices (3,0), (3,1), (3,2)). The
matrix from the hmd has y-axis as up, and I was wondering id you could
help me with keeping the transforms to a minimum.

Now, when i turn my head 90 degrees to the left, i see the scene (slightly
downwards also). When i pitch the helmet, the view pitches. When i roll
the helmet, the view yaws. And when i yaw the helmet, the view rolls. I
suspect i need to rotate the matrix called 'hmdMatrix' 90 degrees some way
to correct the axes, but I'm not very confident in my mathematical skills
right now. Also, adding another rotate might not be needed since we
already do one rotation. I also have to mind the order of
transformation/rotation.

Best regards
Henrik

Code paste:

osg::Matrixf hmdMatrix;
osg::Matrixf viewMatrix;
Producer::Matrix prodrotmat = Producer::Matrix::rotate(-M_PI/2.0,1,0,0);

while( !viewer.done() ){
viewer.sync();
viewer.update();

hmdMatrix = etrack->eeGetOsgMatrix(0);
hmdMatrix (3,0) = 20;
hmdMatrix (3,1) = -75;
hmdMatrix (3,2) = 20;

viewMatrix = myCameraMatrix.inverse(hmdMatrix);
viewer.setViewByMatrix( (Producer::Matrix( viewMatrix.ptr() )) *
prodrotmat );

viewer.frame();
}

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to