Osg osg::matrix::rotate(vec,vec) model rotate question

  c++, opengl

Now I want to change the posture of the cow so that the cow’s head is fixed in a certain direction (the vector is known).

        osg::Vec3d up;
        osg::Vec3d right;
        osg::Vec3d front;
        osg::Vec3d pos;
        osg::Vec3d tempz(0,0,1);
        cowNode->setMatrix(osg::Matrix::rotate(tempz, up)*osg::Matrix::translate(pos));

This can only determine one direction and position, how can the cow rotate to the up ,right, front direction?

Source: Windows Questions C++

LEAVE A COMMENT