btTransform transform; transform.setRotation(btQuaternion(btVector3(0, 1, 0), M_PI_2)); // rotate by 90 degrees around y-axis const btMatrix3x3& basis = transform.getBasis(); std::cout << basis.getColumn(0).x() << " " << basis.getColumn(0).y() << " " << basis.getColumn(0).z() << std::endl;
btTransform transform; transform.setIdentity(); // no rotation or translation const btMatrix3x3& basis = transform.getBasis(); std::cout << basis.getRow(1).x() << " " << basis.getRow(1).y() << " " << basis.getRow(1).z() << std::endl;This example creates a btTransform object with no rotation or translation. The getBasis() function is then used to retrieve the rotation matrix and output the second row vector. Package/library: Bullet Physics library, which can be downloaded from https://pybullet.org/wordpress/ or installed via a package manager such as apt or yum.