Fix Quest hand model orientation;

This commit is contained in:
bjorn 2022-09-23 17:52:21 -07:00
parent d2ceb6b81a
commit a766bf4a35
1 changed files with 7 additions and 4 deletions

View File

@ -1662,9 +1662,8 @@ static ModelData* openxr_newModelData(Device device, bool animated) {
// Add a node that holds the skinned mesh
model->nodes[model->jointCount] = (ModelNode) {
.transform.translation = { 0.f, 0.f, 0.f },
.transform.rotation = { 0.f, 0.f, 0.f, 1.f },
.transform.scale = { 1.f, 1.f, 1.f },
.hasMatrix = true,
.transform = { MAT4_IDENTITY },
.primitiveIndex = 0,
.primitiveCount = 1,
.skin = 0
@ -1752,7 +1751,11 @@ static bool openxr_animate(Device device, Model* model) {
for (uint32_t i = 0; i < COUNTOF(joints); i++) {
if (jointParents[i] == ~0u) {
float position[4] = { 0.f, 0.f, 0.f };
float orientation[4] = { 0.f, 0.f, 0.f, 1.f };
// Quest hand rotation compensation
bool left = device == DEVICE_HAND_LEFT;
float orientation[4] = { -.5f, left ? .5f : -.5f, left ? .5f : -.5f, .5f };
lovrModelSetNodeTransform(model, i, position, scale, orientation, 1.f);
} else {
XrPosef* parent = &joints[jointParents[i]].pose;