NeoSpark314 / godot_oculus_quest_toolkit

An easy to use VR toolkit for Oculus Quest development using the Godot game engine
MIT License
372 stars 39 forks source link

Undo the workaround of clearing the hand tracking bone rest positions #60

Closed goatchurchprime closed 3 years ago

goatchurchprime commented 3 years ago

As in this function: https://github.com/NeoSpark314/godot_oculus_quest_toolkit/blob/master/OQ_Toolkit/OQ_ARVRController/scripts/Feature_HandModel.gd#L247

It looks like a cleaner work-around/transform is to apply the inverse of the rotation of the rest position before assigning the pose value:

https://github.com/NeoSpark314/godot_oculus_quest_toolkit/blob/master/OQ_Toolkit/OQ_ARVRController/scripts/Feature_HandModel.gd#L276

Instead of:

skeleton.set_bone_pose(_vrapi2hand_bone_map[i], Transform(_vrapi_bone_orientations[i]));

do

var j = _vrapi2hand_bone_map[i]
var bone_rest = skeleton.get_bone_rest(j);
skeleton.set_bone_pose(j, (bone_rest.basis.inverse()*Basis(_vrapi_bone_orientations[i])))

This might work more within the grain of how the bone posing system works. I'm sure there's a method in its madness, though I can't see it yet.

NeoSpark314 commented 3 years ago

resolved by #61