i am using code similar to an old 3DxInput example to poll the transformations from the device:
Code: Select all
CComPtr<IAngleAxis> rotation;
CComPtr<IVector3D> translation;
double rotation_angle;
double translation_length;
_3d_sensor->get_Rotation(&rotation);
_3d_sensor->get_Translation(&translation);
rotation->get_Angle(&rotation_angle);
translation->get_Length(&translation_length);
_device->_rotation = mat4f::identity();
_device->_translation = mat4f::identity();
if ( (rotation_angle > 0.0)
|| (translation_length > 0.0)) {
_timer.stop();
_timer.start();
double time_factor = 1.0;
double period; // in millisec
_3d_sensor->get_Period(&period);
time_factor = scm::time::to_milliseconds(_timer.get_time()) / (period * 1000.0);
// translation
vec3d trans_vec;
translation->get_X(&trans_vec.x);
translation->get_Y(&trans_vec.y);
translation->get_Z(&trans_vec.z);
trans_vec *= vec3d(_device->_translation_sensitivity) * time_factor;
translate(_device->_translation, math::vec3f(trans_vec));
// rotation
vec3d rot_axis;
rotation->get_X(&rot_axis.x);
rotation->get_Y(&rot_axis.y);
rotation->get_Z(&rot_axis.z);
rotation_angle *= time_factor;
rotate(_device->_rotation, static_cast<float>(math::rad2deg(rotation_angle)), (math::vec3f(rot_axis)));
}
rotation.Release();
translation.Release();
Where is this problem coming from? Why do i not get the actual values from the device?
-chris