lovr.headset.getSkeleton
EditReturns a list of joint transforms tracked by a device. Currently, only hand devices are able to track joints.
Arguments
Name | Type | Description |
device | Device | The Device to query. |
Returns
Name | Type | Description |
transforms | table |
A list of joint transforms for the device. Each transform is a table with 3 numbers for the position of the joint, 1 number for the joint radius (in meters), and 4 numbers for the angle/axis orientation of the joint. There is also a radius key with the radius of the joint as well.
|
Arguments
Name | Type | Description |
device | Device | The Device to query. |
t | table | A table to fill with the joint transforms, instead of allocating a new one. |
Returns
Name | Type | Description |
transforms | table |
A list of joint transforms for the device. Each transform is a table with 3 numbers for the position of the joint, 1 number for the joint radius (in meters), and 4 numbers for the angle/axis orientation of the joint. There is also a radius key with the radius of the joint as well.
|
Notes
If the Device does not support tracking joints or the transforms are unavailable, nil
is returned.
The joint orientation is similar to the graphics coordinate system: -Z is the forwards direction, pointing towards the fingertips. The +Y direction is "up", pointing out of the back of the hand. The +X direction is to the right, perpendicular to X and Z.
Here's a picture, courtesy of Khronos Group:
Hand joints are returned in the following order:
Joint | Index | |
Palm | 1 | |
Wrist | 2 | |
Thumb | Metacarpal | 3 |
Proximal | 4 | |
Distal | 5 | |
Tip | 6 | |
Index | Metacarpal | 7 |
Proximal | 8 | |
Intermediate | 9 | |
Distal | 10 | |
Tip | 11 | |
Middle | Metacarpal | 12 |
Proximal | 13 | |
Intermediate | 14 | |
Distal | 15 | |
Tip | 16 | |
Ring | Metacarpal | 17 |
Proximal | 18 | |
Intermediate | 19 | |
Distal | 20 | |
Tip | 21 | |
Pinky | Metacarpal | 22 |
Proximal | 23 | |
Intermediate | 24 | |
Distal | 25 | |
Tip | 26 |
Example
function lovr.draw(pass)
for _, hand in ipairs({ 'left', 'right' }) do
for _, joint in ipairs(lovr.headset.getSkeleton(hand) or {}) do
pass:points(unpack(joint, 1, 3))
end
end
end