openvr icon indicating copy to clipboard operation
openvr copied to clipboard

driver code bug: vrmath function always returns {0, 0, 0, 0}

Open lucenas opened this issue 2 years ago • 0 comments

HmdQuaternion_Normalize will always return a quaternion with 0 values, no matter the input.

https://github.com/ValveSoftware/openvr/blob/5e45960cf44d6eb19bbadcae4a3d32578a380c17/samples/drivers/utils/vrmath/vrmath.h#L83-L94

The result quaternion will be initialised with {0, 0, 0, 0} then the following divisions by n will be 0/n, 0/n, 0/n, 0/n.

It could possibly be fixed by modifying the divisors to be the current values of q, instead of 0:

result.w = q.w / n;
result.x = q.x / n;
result.y = q.y / n;
result.z = q.z / n;

This would reflect the expected behaviour.

lucenas avatar Oct 03 '23 01:10 lucenas