Add pose setting system and switch to capsule hands

This commit is contained in:
Rodolphe Houdas 2022-11-14 23:58:56 +00:00
parent 7e8e140ea8
commit b81b667a97
8 changed files with 1495 additions and 428 deletions

View file

@ -3,9 +3,12 @@
[node name="MenuButton" type="MenuButton"]
offset_right = 119.0
offset_bottom = 34.0
text = "Hello"
text = "Hands tools"
item_count = 2
popup/item_0/text = "Create hands"
popup/item_0/id = 0
popup/item_1/text = "Test"
popup/item_1/text = "Set poses"
popup/item_1/id = 1
[node name="FileDialog" type="FileDialog" parent="."]
size = Vector2i(442, 620)

View file

@ -6,12 +6,27 @@ var eds = get_editor_interface().get_selection()
var selected_node
var fd : FileDialog
var finger_names : Array = [
"Thumb",
"Index",
"Middle",
"Ring",
"Pinky"
]
func _enter_tree():
# Initialization of the plugin goes here.
# Load the dock scene and instantiate it.
button = preload("res://addons/UltraleapHandMenu/Button.tscn").instantiate()
button.visible = false
button.get_popup().id_pressed.connect(_on_id_pressed)
fd = button.get_node("FileDialog")
fd.file_mode = FileDialog.FILE_MODE_OPEN_FILES
fd.access = FileDialog.ACCESS_RESOURCES
fd.files_selected.connect(_on_file_selected)
# Add the loaded scene to the docks.
add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_MENU, button)
@ -33,8 +48,8 @@ func _on_selection_changed():
if selected.size() == 1:
# Always pick first node in selection
selected_node = selected[0]
if selected_node is DebugHands:
if selected[0] is DebugHands:
selected_node = selected[0]
button.visible = true
else:
button.visible = false
@ -44,6 +59,9 @@ func _on_id_pressed(id : int):
print("Create hands")
create_hand(UltraleapTypes.Chirality.Left, selected_node)
create_hand(UltraleapTypes.Chirality.Right, selected_node)
if id == 1:
print("Apply pose")
fd.popup_centered()
func create_hand(chirality : UltraleapTypes.Chirality, parent : Node):
var prefix : String = "Left" if chirality == UltraleapTypes.Chirality.Left else "Right"
@ -76,7 +94,6 @@ func create_hand(chirality : UltraleapTypes.Chirality, parent : Node):
return hand
func create_finger(prefix : String, type : String, parent : Node):
prefix = prefix + type
@ -101,7 +118,72 @@ func create_finger(prefix : String, type : String, parent : Node):
func create_bone(prefix : String, name : String):
var bone = MeshInstance3D.new()
bone.mesh = BoxMesh.new()
bone.mesh = CapsuleMesh.new()
bone.name = prefix + name
bone.mesh.material = StandardMaterial3D.new()
bone.mesh.radial_segments = 8
bone.mesh.rings = 4
return bone
func _on_file_selected(paths):
print(paths)
for path in paths:
var file = load(path)
if file is UltraleapHand:
var hand : UltraleapHand = file as UltraleapHand
set_hand_transform(hand, hand.type)
func set_hand_transform(hand : UltraleapHand, chirality : UltraleapTypes.Chirality):
var chirality_str = chirality_to_str(chirality)
var hand_root = selected_node.get_node(chirality_str + "Hand") as Node3D
var arm = hand_root.get_node(chirality_str + "Arm")
set_bone_transform(hand.arm, arm)
for i in range(5):
set_finger_transform(hand.digits[i], chirality, finger_names[i], hand_root)
func set_finger_transform(digit : UltraleapDigit, chirality : UltraleapTypes.Chirality, finger : String, node : Node3D):
var chirality_str = chirality_to_str(chirality)
var palm = node.get_node(chirality_str + "Palm")
var metacarpal = palm.get_node(chirality_str + finger + "Metacarpal")
var proximal = metacarpal.get_node(chirality_str + finger + "Proximal")
var intermediate = proximal.get_node(chirality_str + finger + "Intermediate")
var distal = intermediate.get_node(chirality_str + finger + "Distal")
set_bone_transform(digit.metacarpal, metacarpal)
set_bone_transform(digit.proximal, proximal)
set_bone_transform(digit.intermediate, intermediate)
set_bone_transform(digit.distal, distal)
func set_bone_transform(bone : UltraleapBone, model : Node3D):
var pos = (bone.next_joint + bone.prev_joint) / 2
var length = (bone.next_joint - bone.prev_joint).length()
var transform_m : Transform3D = Transform3D(selected_node.global_transform)
model.global_position = transform_m * pos
# Multiply by quaternion, which is this object rotation, to rotate the hands
model.global_rotation = (selected_node.quaternion * bone.rotation * Quaternion(Vector3.RIGHT, deg_to_rad(90))).get_euler()
var mesh
var material
if model is CSGBox3D:
mesh = model
material = (mesh.material as StandardMaterial3D)
if model is MeshInstance3D:
mesh = model.mesh
material = model.mesh.material
if mesh is CapsuleMesh:
mesh.radius = bone.width / 2
mesh.height = length
else:
mesh.size.x = bone.width
mesh.size.z = length
mesh.size.y = 0.01
func chirality_to_str(chirality : UltraleapTypes.Chirality):
return "Left" if chirality == UltraleapTypes.Left else "Right"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,186 @@
[gd_resource type="UltraleapHand" load_steps=28 format=3]
[sub_resource type="UltraleapBone" id="UltraleapBone_xoiti"]
prev_joint = Vector3(-0.242166, 0.212027, 0.268517)
next_joint = Vector3(-0.156028, 0.200083, 0.0355908)
width = 0.0586766
rotation = Quaternion(-0.0122591, -0.177286, -0.0675975, 0.981759)
[sub_resource type="UltraleapBone" id="UltraleapBone_emmf4"]
prev_joint = Vector3(-0.0751344, 0.17824, -0.0304874)
next_joint = Vector3(-0.0632835, 0.174962, -0.0433912)
width = 0.0186472
rotation = Quaternion(0.144483, -0.342264, -0.576018, 0.728137)
[sub_resource type="UltraleapBone" id="UltraleapBone_mgvsj"]
prev_joint = Vector3(-0.0933914, 0.183441, -0.0111822)
next_joint = Vector3(-0.0751344, 0.17824, -0.0304874)
width = 0.0186472
rotation = Quaternion(0.145003, -0.349948, -0.574975, 0.7252)
[sub_resource type="UltraleapBone" id="UltraleapBone_teb54"]
prev_joint = Vector3(-0.128127, 0.192121, 0.0205825)
next_joint = Vector3(-0.128127, 0.192121, 0.0205825)
width = 0.0186472
rotation = Quaternion(0.197783, -0.258279, -0.556755, 0.764328)
[sub_resource type="UltraleapBone" id="UltraleapBone_o4oj1"]
prev_joint = Vector3(-0.128127, 0.192121, 0.0205825)
next_joint = Vector3(-0.0933914, 0.183441, -0.0111822)
width = 0.0186472
rotation = Quaternion(0.167375, -0.37438, -0.562992, 0.717541)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_p1cs7"]
metacarpal = SubResource("UltraleapBone_teb54")
proximal = SubResource("UltraleapBone_o4oj1")
intermediate = SubResource("UltraleapBone_mgvsj")
distal = SubResource("UltraleapBone_emmf4")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_jmj60"]
prev_joint = Vector3(-0.0919795, 0.201117, -0.100284)
next_joint = Vector3(-0.0873894, 0.195646, -0.117992)
width = 0.0178118
rotation = Quaternion(-0.133947, -0.135453, -0.0910671, 0.977455)
[sub_resource type="UltraleapBone" id="UltraleapBone_xja1m"]
prev_joint = Vector3(-0.0975504, 0.203237, -0.0788053)
next_joint = Vector3(-0.0919795, 0.201117, -0.100284)
width = 0.0178118
rotation = Quaternion(-0.0377239, -0.129557, -0.0794916, 0.98766)
[sub_resource type="UltraleapBone" id="UltraleapBone_irq0k"]
prev_joint = Vector3(-0.130682, 0.207094, 0.0157571)
next_joint = Vector3(-0.106847, 0.201041, -0.0473686)
width = 0.0178118
rotation = Quaternion(-0.0306876, -0.182105, -0.0802484, 0.979518)
[sub_resource type="UltraleapBone" id="UltraleapBone_4fh7o"]
prev_joint = Vector3(-0.106847, 0.201041, -0.0473686)
next_joint = Vector3(-0.0975504, 0.203237, -0.0788053)
width = 0.0178118
rotation = Quaternion(0.043594, -0.140357, -0.0683411, 0.986777)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_rsc1f"]
metacarpal = SubResource("UltraleapBone_irq0k")
proximal = SubResource("UltraleapBone_4fh7o")
intermediate = SubResource("UltraleapBone_xja1m")
distal = SubResource("UltraleapBone_jmj60")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_v0wqh"]
prev_joint = Vector3(-0.124343, 0.20819, -0.116506)
next_joint = Vector3(-0.123551, 0.202871, -0.135007)
width = 0.0174936
rotation = Quaternion(-0.139616, -0.0193886, 0.00988309, 0.989967)
[sub_resource type="UltraleapBone" id="UltraleapBone_w5od5"]
prev_joint = Vector3(-0.124223, 0.209871, -0.0895105)
next_joint = Vector3(-0.124343, 0.20819, -0.116506)
width = 0.0174936
rotation = Quaternion(-0.0310709, 0.00249982, 0.00901692, 0.999473)
[sub_resource type="UltraleapBone" id="UltraleapBone_vriov"]
prev_joint = Vector3(-0.138468, 0.210277, 0.0103009)
next_joint = Vector3(-0.124189, 0.205786, -0.052177)
width = 0.0174936
rotation = Quaternion(-0.035504, -0.1118, 0.00272541, 0.993093)
[sub_resource type="UltraleapBone" id="UltraleapBone_1o5sr"]
prev_joint = Vector3(-0.124189, 0.205786, -0.052177)
next_joint = Vector3(-0.124223, 0.209871, -0.0895105)
width = 0.0174936
rotation = Quaternion(0.0544636, -3.17955e-05, 0.00887269, 0.998476)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_fxedf"]
metacarpal = SubResource("UltraleapBone_vriov")
proximal = SubResource("UltraleapBone_1o5sr")
intermediate = SubResource("UltraleapBone_w5od5")
distal = SubResource("UltraleapBone_v0wqh")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_xk2va"]
prev_joint = Vector3(-0.14758, 0.214336, -0.108373)
next_joint = Vector3(-0.14778, 0.211282, -0.124827)
width = 0.0166463
rotation = Quaternion(-0.091279, 0.0100217, 0.0437806, 0.994812)
[sub_resource type="UltraleapBone" id="UltraleapBone_q1xbq"]
prev_joint = Vector3(-0.147022, 0.213653, -0.0875538)
next_joint = Vector3(-0.147584, 0.214552, -0.108163)
width = 0.0166468
rotation = Quaternion(0.0168819, 0.01243, 0.0426797, 0.998869)
[sub_resource type="UltraleapBone" id="UltraleapBone_s7ick"]
prev_joint = Vector3(-0.150645, 0.209789, 0.00595115)
next_joint = Vector3(-0.14634, 0.206916, -0.0515001)
width = 0.0166468
rotation = Quaternion(-0.0263354, -0.0363733, 0.0381872, 0.998261)
[sub_resource type="UltraleapBone" id="UltraleapBone_yrrb8"]
prev_joint = Vector3(-0.14634, 0.206916, -0.0515001)
next_joint = Vector3(-0.147036, 0.213872, -0.0873451)
width = 0.0166468
rotation = Quaternion(0.0959872, 0.00559608, 0.0413934, 0.994506)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_744qk"]
metacarpal = SubResource("UltraleapBone_s7ick")
proximal = SubResource("UltraleapBone_yrrb8")
intermediate = SubResource("UltraleapBone_q1xbq")
distal = SubResource("UltraleapBone_xk2va")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_gup4j"]
prev_joint = Vector3(-0.174747, 0.207821, -0.0883366)
next_joint = Vector3(-0.176877, 0.204237, -0.102418)
width = 0.014787
rotation = Quaternion(-0.112007, 0.0895733, 0.136359, 0.980223)
[sub_resource type="UltraleapBone" id="UltraleapBone_y64eq"]
prev_joint = Vector3(-0.170911, 0.208353, -0.0692769)
next_joint = Vector3(-0.174747, 0.207821, -0.0883366)
width = 0.014787
rotation = Quaternion(-0.00109626, 0.100043, 0.125967, 0.986976)
[sub_resource type="UltraleapBone" id="UltraleapBone_pan52"]
prev_joint = Vector3(-0.161442, 0.203634, 0.00795982)
next_joint = Vector3(-0.164593, 0.20411, -0.0453424)
width = 0.014787
rotation = Quaternion(0.00792622, 0.0287838, 0.118308, 0.992528)
[sub_resource type="UltraleapBone" id="UltraleapBone_kdrgk"]
prev_joint = Vector3(-0.164593, 0.20411, -0.0453424)
next_joint = Vector3(-0.170911, 0.208353, -0.0692769)
width = 0.014787
rotation = Quaternion(0.0997067, 0.116471, 0.115027, 0.981459)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_nmrre"]
metacarpal = SubResource("UltraleapBone_pan52")
proximal = SubResource("UltraleapBone_kdrgk")
intermediate = SubResource("UltraleapBone_y64eq")
distal = SubResource("UltraleapBone_gup4j")
is_extended = true
[sub_resource type="UltraleapPalm" id="UltraleapPalm_ndiwh"]
position = Vector3(-0.133517, 0.19979, -0.0307226)
velocity = Vector3(-0.00247315, 0.0181483, 0.0193792)
normal = Vector3(-0.000114195, -0.000987558, -0.000108117)
direction = Vector3(0.000213238, 8.19272e-05, -0.000973559)
width = 0.0837909
orientation = Quaternion(0.0479237, -0.104517, -0.0626455, 0.99139)
[resource]
type = 0
confidence = 1.0
visible_time = 14143095
pinch_distance = 58.9579
pinch_strength = 0.0
grab_angle = 0.198241
thumb = SubResource("UltraleapDigit_p1cs7")
index = SubResource("UltraleapDigit_rsc1f")
middle = SubResource("UltraleapDigit_fxedf")
ring = SubResource("UltraleapDigit_744qk")
pinky = SubResource("UltraleapDigit_nmrre")
arm = SubResource("UltraleapBone_xoiti")
palm = SubResource("UltraleapPalm_ndiwh")
digits = [SubResource("UltraleapDigit_p1cs7"), SubResource("UltraleapDigit_rsc1f"), SubResource("UltraleapDigit_fxedf"), SubResource("UltraleapDigit_744qk"), SubResource("UltraleapDigit_nmrre")]

View file

@ -0,0 +1,186 @@
[gd_resource type="UltraleapHand" load_steps=28 format=3]
[sub_resource type="UltraleapBone" id="UltraleapBone_mh27w"]
prev_joint = Vector3(0.337863, 0.206906, 0.183826)
next_joint = Vector3(0.149874, 0.201883, 0.0225923)
width = 0.0584601
rotation = Quaternion(0.0352042, 0.416311, 0.10071, 0.902942)
[sub_resource type="UltraleapBone" id="UltraleapBone_s3uui"]
prev_joint = Vector3(0.0611236, 0.171679, -0.0281999)
next_joint = Vector3(0.0477002, 0.167588, -0.0386412)
width = 0.0185784
rotation = Quaternion(0.174186, 0.413749, 0.571749, 0.686713)
[sub_resource type="UltraleapBone" id="UltraleapBone_3fqsu"]
prev_joint = Vector3(0.0808383, 0.178429, -0.0121937)
next_joint = Vector3(0.0611236, 0.171679, -0.0281999)
width = 0.0185784
rotation = Quaternion(0.16034, 0.411963, 0.578577, 0.685439)
[sub_resource type="UltraleapBone" id="UltraleapBone_hkq0w"]
prev_joint = Vector3(0.117662, 0.191586, 0.0146278)
next_joint = Vector3(0.117662, 0.191586, 0.0146278)
width = 0.0185784
rotation = Quaternion(0.206978, 0.337522, 0.563746, 0.724865)
[sub_resource type="UltraleapBone" id="UltraleapBone_roarc"]
prev_joint = Vector3(0.117662, 0.191586, 0.0146278)
next_joint = Vector3(0.0808383, 0.178429, -0.0121937)
width = 0.0185784
rotation = Quaternion(0.164445, 0.436049, 0.572548, 0.674543)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_aeao8"]
metacarpal = SubResource("UltraleapBone_hkq0w")
proximal = SubResource("UltraleapBone_roarc")
intermediate = SubResource("UltraleapBone_3fqsu")
distal = SubResource("UltraleapBone_s3uui")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_4f2bl"]
prev_joint = Vector3(0.0604351, 0.191876, -0.0971828)
next_joint = Vector3(0.052953, 0.184713, -0.112863)
width = 0.0177461
rotation = Quaternion(-0.165912, 0.235117, 0.142263, 0.947077)
[sub_resource type="UltraleapBone" id="UltraleapBone_jbkx7"]
prev_joint = Vector3(0.070248, 0.19593, -0.0779334)
next_joint = Vector3(0.0604351, 0.191876, -0.0971828)
width = 0.0177461
rotation = Quaternion(-0.0662496, 0.240404, 0.118703, 0.961107)
[sub_resource type="UltraleapBone" id="UltraleapBone_8hard"]
prev_joint = Vector3(0.118306, 0.206989, 0.00847042)
next_joint = Vector3(0.0862202, 0.19534, -0.0497587)
width = 0.0177461
rotation = Quaternion(-0.0589001, 0.25531, 0.116992, 0.957946)
[sub_resource type="UltraleapBone" id="UltraleapBone_kyxal"]
prev_joint = Vector3(0.0862202, 0.19534, -0.0497587)
next_joint = Vector3(0.070248, 0.19593, -0.0779334)
width = 0.0177461
rotation = Quaternion(0.0338887, 0.252894, 0.0929567, 0.962421)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_wwnoa"]
metacarpal = SubResource("UltraleapBone_8hard")
proximal = SubResource("UltraleapBone_kyxal")
intermediate = SubResource("UltraleapBone_jbkx7")
distal = SubResource("UltraleapBone_4f2bl")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_ino0a"]
prev_joint = Vector3(0.0904054, 0.197018, -0.11871)
next_joint = Vector3(0.0866504, 0.190266, -0.136176)
width = 0.017429
rotation = Quaternion(-0.175901, 0.108602, 0.0445718, 0.977383)
[sub_resource type="UltraleapBone" id="UltraleapBone_lh21q"]
prev_joint = Vector3(0.0950303, 0.201369, -0.0931299)
next_joint = Vector3(0.0904054, 0.197018, -0.11871)
width = 0.017429
rotation = Quaternion(-0.0797479, 0.0914822, 0.0376305, 0.991895)
[sub_resource type="UltraleapBone" id="UltraleapBone_pi0kf"]
prev_joint = Vector3(0.124809, 0.210038, 0.00178506)
next_joint = Vector3(0.10207, 0.200708, -0.0573167)
width = 0.017429
rotation = Quaternion(-0.0673964, 0.18382, 0.0371905, 0.979941)
[sub_resource type="UltraleapBone" id="UltraleapBone_jpnn0"]
prev_joint = Vector3(0.10207, 0.200708, -0.0573167)
next_joint = Vector3(0.0950303, 0.201369, -0.0931299)
width = 0.017429
rotation = Quaternion(0.0119158, 0.0965748, 0.0288785, 0.994835)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_xalse"]
metacarpal = SubResource("UltraleapBone_pi0kf")
proximal = SubResource("UltraleapBone_jpnn0")
intermediate = SubResource("UltraleapBone_lh21q")
distal = SubResource("UltraleapBone_ino0a")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_wye5x"]
prev_joint = Vector3(0.117001, 0.207795, -0.115492)
next_joint = Vector3(0.115136, 0.204392, -0.131241)
width = 0.0165848
rotation = Quaternion(-0.105517, 0.0581978, 0.00250543, 0.99271)
[sub_resource type="UltraleapBone" id="UltraleapBone_pofrl"]
prev_joint = Vector3(0.11934, 0.208186, -0.0953997)
next_joint = Vector3(0.117001, 0.207795, -0.115492)
width = 0.0165848
rotation = Quaternion(-0.0098673, 0.0578624, -0.00305235, 0.998271)
[sub_resource type="UltraleapBone" id="UltraleapBone_esuup"]
prev_joint = Vector3(0.13637, 0.210239, -0.00479586)
next_joint = Vector3(0.124036, 0.203558, -0.0605269)
width = 0.0165848
rotation = Quaternion(-0.0581834, 0.108341, 0.00353467, 0.992403)
[sub_resource type="UltraleapBone" id="UltraleapBone_nse00"]
prev_joint = Vector3(0.124036, 0.203558, -0.0605269)
next_joint = Vector3(0.11934, 0.208186, -0.0953997)
width = 0.0165848
rotation = Quaternion(0.0649824, 0.066935, -0.00747238, 0.995611)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_ypunr"]
metacarpal = SubResource("UltraleapBone_esuup")
proximal = SubResource("UltraleapBone_nse00")
intermediate = SubResource("UltraleapBone_pofrl")
distal = SubResource("UltraleapBone_wye5x")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_gvgsb"]
prev_joint = Vector3(0.149578, 0.20781, -0.100144)
next_joint = Vector3(0.15078, 0.20512, -0.114003)
width = 0.014732
rotation = Quaternion(-0.0911025, -0.0513198, -0.0919232, 0.990261)
[sub_resource type="UltraleapBone" id="UltraleapBone_pyi10"]
prev_joint = Vector3(0.147089, 0.207387, -0.0813874)
next_joint = Vector3(0.149578, 0.20781, -0.100144)
width = 0.014732
rotation = Quaternion(0.0168167, -0.0646897, -0.0854565, 0.994097)
[sub_resource type="UltraleapBone" id="UltraleapBone_4gng0"]
prev_joint = Vector3(0.1482, 0.205091, -0.00447434)
next_joint = Vector3(0.143506, 0.202556, -0.0574049)
width = 0.014732
rotation = Quaternion(-0.027207, 0.0421936, -0.0772447, 0.995747)
[sub_resource type="UltraleapBone" id="UltraleapBone_yrt0l"]
prev_joint = Vector3(0.143506, 0.202556, -0.0574049)
next_joint = Vector3(0.147089, 0.207387, -0.0813874)
width = 0.014732
rotation = Quaternion(0.103962, -0.0648985, -0.0793752, 0.989282)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_48ugw"]
metacarpal = SubResource("UltraleapBone_4gng0")
proximal = SubResource("UltraleapBone_yrt0l")
intermediate = SubResource("UltraleapBone_pyi10")
distal = SubResource("UltraleapBone_gvgsb")
is_extended = true
[sub_resource type="UltraleapPalm" id="UltraleapPalm_6hmbe"]
position = Vector3(0.114966, 0.196751, -0.0376759)
velocity = Vector3(-0.0186017, 0.0492119, 0.0119054)
normal = Vector3(0.00018089, -0.000980605, -7.54521e-05)
direction = Vector3(-0.00035919, 5.54918e-06, -0.000933248)
width = 0.0834791
orientation = Quaternion(0.0206964, 0.181515, 0.0962771, 0.978445)
[resource]
type = 1
confidence = 1.0
visible_time = 14798998
pinch_distance = 56.0784
pinch_strength = 0.0
grab_angle = 0.167465
thumb = SubResource("UltraleapDigit_aeao8")
index = SubResource("UltraleapDigit_wwnoa")
middle = SubResource("UltraleapDigit_xalse")
ring = SubResource("UltraleapDigit_ypunr")
pinky = SubResource("UltraleapDigit_48ugw")
arm = SubResource("UltraleapBone_mh27w")
palm = SubResource("UltraleapPalm_6hmbe")
digits = [SubResource("UltraleapDigit_aeao8"), SubResource("UltraleapDigit_wwnoa"), SubResource("UltraleapDigit_xalse"), SubResource("UltraleapDigit_ypunr"), SubResource("UltraleapDigit_48ugw")]

View file

@ -0,0 +1,185 @@
[gd_resource type="UltraleapHand" load_steps=28 format=3 uid="uid://bvoh8ap8dfvad"]
[sub_resource type="UltraleapBone" id="UltraleapBone_lbm1t"]
prev_joint = Vector3(0.105797, 0.106463, 0.222454)
next_joint = Vector3(0.0962732, 0.261271, 0.0549831)
width = 0.0538695
rotation = Quaternion(0.353848, 0.0891644, -0.171632, 0.915087)
[sub_resource type="UltraleapBone" id="UltraleapBone_hi05p"]
prev_joint = Vector3(0.153346, 0.235269, -0.0302259)
next_joint = Vector3(0.159576, 0.229743, -0.0492221)
width = 0.0171195
rotation = Quaternion(0.0249458, -0.203583, -0.733738, 0.647735)
[sub_resource type="UltraleapBone" id="UltraleapBone_jn2hu"]
prev_joint = Vector3(0.136207, 0.243404, -0.00581395)
next_joint = Vector3(0.153346, 0.235269, -0.0302259)
width = 0.0171195
rotation = Quaternion(0.122014, -0.300527, -0.697295, 0.639199)
[sub_resource type="UltraleapBone" id="UltraleapBone_rkj2r"]
prev_joint = Vector3(0.115779, 0.253396, 0.0212904)
next_joint = Vector3(0.115779, 0.253396, 0.0212904)
width = 0.0171195
rotation = Quaternion(0.196237, -0.0194352, -0.67891, 0.707244)
[sub_resource type="UltraleapBone" id="UltraleapBone_ee1rf"]
prev_joint = Vector3(0.115779, 0.253396, 0.0212904)
next_joint = Vector3(0.136207, 0.243404, -0.00581395)
width = 0.0171195
rotation = Quaternion(0.125337, -0.318196, -0.693526, 0.634085)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_ul7u5"]
metacarpal = SubResource("UltraleapBone_rkj2r")
proximal = SubResource("UltraleapBone_ee1rf")
intermediate = SubResource("UltraleapBone_jn2hu")
distal = SubResource("UltraleapBone_hi05p")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_o3a8k"]
prev_joint = Vector3(0.113553, 0.27372, -0.0886922)
next_joint = Vector3(0.10973, 0.263547, -0.104358)
width = 0.0163526
rotation = Quaternion(-0.294373, 0.0501985, -0.180777, 0.937093)
[sub_resource type="UltraleapBone" id="UltraleapBone_ynlwy"]
prev_joint = Vector3(0.116979, 0.283474, -0.0642118)
next_joint = Vector3(0.113553, 0.27372, -0.0886922)
width = 0.0163526
rotation = Quaternion(-0.196288, 0.0293546, -0.184405, 0.962603)
[sub_resource type="UltraleapBone" id="UltraleapBone_55ji7"]
prev_joint = Vector3(0.116904, 0.272719, 0.0360118)
next_joint = Vector3(0.115754, 0.286976, -0.0245178)
width = 0.0163526
rotation = Quaternion(0.111792, 0.0300449, -0.179819, 0.976865)
[sub_resource type="UltraleapBone" id="UltraleapBone_eyc3y"]
prev_joint = Vector3(0.115754, 0.286976, -0.0245178)
next_joint = Vector3(0.116979, 0.283474, -0.0642118)
width = 0.0163526
rotation = Quaternion(-0.0404221, -0.0231446, -0.182199, 0.982158)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_iqr8i"]
metacarpal = SubResource("UltraleapBone_55ji7")
proximal = SubResource("UltraleapBone_eyc3y")
intermediate = SubResource("UltraleapBone_ynlwy")
distal = SubResource("UltraleapBone_o3a8k")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_vsppu"]
prev_joint = Vector3(0.0861885, 0.290098, -0.0975001)
next_joint = Vector3(0.0823642, 0.280078, -0.11731)
width = 0.0160604
rotation = Quaternion(-0.235305, 0.0702843, -0.0719853, 0.966701)
[sub_resource type="UltraleapBone" id="UltraleapBone_661vl"]
prev_joint = Vector3(0.090458, 0.29931, -0.0679116)
next_joint = Vector3(0.0861885, 0.290098, -0.0975001)
width = 0.0160604
rotation = Quaternion(-0.15416, 0.0574757, -0.0760136, 0.983439)
[sub_resource type="UltraleapBone" id="UltraleapBone_g6vwm"]
prev_joint = Vector3(0.103134, 0.279571, 0.0365603)
next_joint = Vector3(0.0944877, 0.29567, -0.0195201)
width = 0.0160604
rotation = Quaternion(0.131032, 0.0862104, -0.0878224, 0.98371)
[sub_resource type="UltraleapBone" id="UltraleapBone_g3f12"]
prev_joint = Vector3(0.0944877, 0.29567, -0.0195201)
next_joint = Vector3(0.090458, 0.29931, -0.0679116)
width = 0.0160604
rotation = Quaternion(0.0337366, 0.0445063, -0.0858356, 0.994743)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_jprwb"]
metacarpal = SubResource("UltraleapBone_g6vwm")
proximal = SubResource("UltraleapBone_g3f12")
intermediate = SubResource("UltraleapBone_661vl")
distal = SubResource("UltraleapBone_vsppu")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_fx4lp"]
prev_joint = Vector3(0.0669095, 0.302472, -0.0861597)
next_joint = Vector3(0.0640295, 0.297179, -0.105708)
width = 0.0152825
rotation = Quaternion(-0.132861, 0.0673559, -0.0287378, 0.988426)
[sub_resource type="UltraleapBone" id="UltraleapBone_a3k3i"]
prev_joint = Vector3(0.0713012, 0.305731, -0.0595885)
next_joint = Vector3(0.0669095, 0.302472, -0.0861597)
width = 0.0152825
rotation = Quaternion(-0.0632217, 0.0791725, -0.0352404, 0.99423)
[sub_resource type="UltraleapBone" id="UltraleapBone_dy7tn"]
prev_joint = Vector3(0.0920613, 0.281608, 0.0334182)
next_joint = Vector3(0.0769458, 0.298136, -0.0145686)
width = 0.0152825
rotation = Quaternion(0.153305, 0.153034, -0.0426768, 0.975324)
[sub_resource type="UltraleapBone" id="UltraleapBone_x52fa"]
prev_joint = Vector3(0.0769458, 0.298136, -0.0145686)
next_joint = Vector3(0.0713012, 0.305731, -0.0595885)
width = 0.0152825
rotation = Quaternion(0.0800713, 0.065433, -0.0457546, 0.993586)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_e25p2"]
metacarpal = SubResource("UltraleapBone_dy7tn")
proximal = SubResource("UltraleapBone_x52fa")
intermediate = SubResource("UltraleapBone_a3k3i")
distal = SubResource("UltraleapBone_fx4lp")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_y3in4"]
prev_joint = Vector3(0.047725, 0.304341, -0.0561866)
next_joint = Vector3(0.0444037, 0.302016, -0.073518)
width = 0.0135751
rotation = Quaternion(-0.0595665, 0.0979589, 0.0639955, 0.991343)
[sub_resource type="UltraleapBone" id="UltraleapBone_oshyy"]
prev_joint = Vector3(0.0528173, 0.305101, -0.0338533)
next_joint = Vector3(0.047725, 0.304341, -0.0561866)
width = 0.0135751
rotation = Quaternion(-0.0100955, 0.112595, 0.0582624, 0.99188)
[sub_resource type="UltraleapBone" id="UltraleapBone_m8wfq"]
prev_joint = Vector3(0.0804068, 0.278797, 0.0354821)
next_joint = Vector3(0.0610212, 0.297352, -0.00554226)
width = 0.0135751
rotation = Quaternion(0.205841, 0.197976, 0.0396338, 0.95753)
[sub_resource type="UltraleapBone" id="UltraleapBone_mxp20"]
prev_joint = Vector3(0.0610212, 0.297352, -0.00554226)
next_joint = Vector3(0.0528173, 0.305101, -0.0338533)
width = 0.0135751
rotation = Quaternion(0.135046, 0.131529, 0.0409672, 0.981216)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_krs5j"]
metacarpal = SubResource("UltraleapBone_m8wfq")
proximal = SubResource("UltraleapBone_mxp20")
intermediate = SubResource("UltraleapBone_oshyy")
distal = SubResource("UltraleapBone_y3in4")
is_extended = true
[sub_resource type="UltraleapPalm" id="UltraleapPalm_uk8ct"]
position = Vector3(0.0938312, 0.285339, -0.00423101)
velocity = Vector3(-0.0244792, 0.011608, 0.00902039)
normal = Vector3(-0.000356817, -0.000866262, -0.000349673)
direction = Vector3(-0.000122414, 0.000414443, -0.000901805)
width = 0.0769238
orientation = Quaternion(0.198779, 0.0979014, -0.165396, 0.961013)
[resource]
confidence = 1.0
visible_time = 16009953
pinch_distance = 69.2916
pinch_strength = 1.68928e-16
grab_angle = 0.681329
thumb = SubResource("UltraleapDigit_ul7u5")
index = SubResource("UltraleapDigit_iqr8i")
middle = SubResource("UltraleapDigit_jprwb")
ring = SubResource("UltraleapDigit_e25p2")
pinky = SubResource("UltraleapDigit_krs5j")
arm = SubResource("UltraleapBone_lbm1t")
palm = SubResource("UltraleapPalm_uk8ct")
digits = [SubResource("UltraleapDigit_ul7u5"), SubResource("UltraleapDigit_iqr8i"), SubResource("UltraleapDigit_jprwb"), SubResource("UltraleapDigit_e25p2"), SubResource("UltraleapDigit_krs5j")]

View file

@ -0,0 +1,185 @@
[gd_resource type="UltraleapHand" load_steps=28 format=3]
[sub_resource type="UltraleapBone" id="UltraleapBone_1icww"]
prev_joint = Vector3(-0.0953206, 0.118873, 0.233014)
next_joint = Vector3(-0.125004, 0.267509, 0.0585405)
width = 0.0545435
rotation = Quaternion(0.349459, -0.0205126, 0.236958, 0.906261)
[sub_resource type="UltraleapBone" id="UltraleapBone_cnjss"]
prev_joint = Vector3(-0.183962, 0.241495, -0.02327)
next_joint = Vector3(-0.193067, 0.236363, -0.0410161)
width = 0.0173337
rotation = Quaternion(0.0934592, 0.245836, 0.7415, 0.617259)
[sub_resource type="UltraleapBone" id="UltraleapBone_nps76"]
prev_joint = Vector3(-0.165338, 0.248581, -0.0012024)
next_joint = Vector3(-0.183962, 0.241495, -0.02327)
width = 0.0173337
rotation = Quaternion(0.171774, 0.315275, 0.708777, 0.607231)
[sub_resource type="UltraleapBone" id="UltraleapBone_3q5x5"]
prev_joint = Vector3(-0.144322, 0.257833, 0.0237301)
next_joint = Vector3(-0.144322, 0.257833, 0.0237301)
width = 0.0173337
rotation = Quaternion(0.184814, 0.0265674, 0.709992, 0.679006)
[sub_resource type="UltraleapBone" id="UltraleapBone_f0w6k"]
prev_joint = Vector3(-0.144322, 0.257833, 0.0237301)
next_joint = Vector3(-0.165338, 0.248581, -0.0012024)
width = 0.0173337
rotation = Quaternion(0.159587, 0.326715, 0.711463, 0.601339)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_pwedm"]
metacarpal = SubResource("UltraleapBone_3q5x5")
proximal = SubResource("UltraleapBone_f0w6k")
intermediate = SubResource("UltraleapBone_nps76")
distal = SubResource("UltraleapBone_cnjss")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_1vup7"]
prev_joint = Vector3(-0.146347, 0.279446, -0.0875171)
next_joint = Vector3(-0.142456, 0.269786, -0.103427)
width = 0.0165572
rotation = Quaternion(-0.282876, -0.0404094, 0.228723, 0.930609)
[sub_resource type="UltraleapBone" id="UltraleapBone_p2d2w"]
prev_joint = Vector3(-0.149074, 0.288314, -0.0628029)
next_joint = Vector3(-0.146347, 0.279446, -0.0875171)
width = 0.0165572
rotation = Quaternion(-0.178265, -0.0109936, 0.230687, 0.956496)
[sub_resource type="UltraleapBone" id="UltraleapBone_hix7v"]
prev_joint = Vector3(-0.14735, 0.276906, 0.038649)
next_joint = Vector3(-0.146374, 0.2906, -0.022811)
width = 0.0165572
rotation = Quaternion(0.104863, -0.0320861, 0.222558, 0.968732)
[sub_resource type="UltraleapBone" id="UltraleapBone_cpq1m"]
prev_joint = Vector3(-0.146374, 0.2906, -0.022811)
next_joint = Vector3(-0.149074, 0.288314, -0.0628029)
width = 0.0165572
rotation = Quaternion(-0.0200998, 0.0392447, 0.227092, 0.972875)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_y7156"]
metacarpal = SubResource("UltraleapBone_hix7v")
proximal = SubResource("UltraleapBone_cpq1m")
intermediate = SubResource("UltraleapBone_p2d2w")
distal = SubResource("UltraleapBone_1vup7")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_njbt1"]
prev_joint = Vector3(-0.118509, 0.307852, -0.0940531)
next_joint = Vector3(-0.114258, 0.301301, -0.113985)
width = 0.0162614
rotation = Quaternion(-0.16681, -0.0814074, 0.119148, 0.975372)
[sub_resource type="UltraleapBone" id="UltraleapBone_rs6ku"]
prev_joint = Vector3(-0.122792, 0.311597, -0.0643308)
next_joint = Vector3(-0.118509, 0.307852, -0.0940531)
width = 0.0162614
rotation = Quaternion(-0.0706273, -0.0626941, 0.125468, 0.987593)
[sub_resource type="UltraleapBone" id="UltraleapBone_v81fi"]
prev_joint = Vector3(-0.13438, 0.284819, 0.0393564)
next_joint = Vector3(-0.12608, 0.301078, -0.0175054)
width = 0.0162614
rotation = Quaternion(0.127202, -0.0880538, 0.131483, 0.979172)
[sub_resource type="UltraleapBone" id="UltraleapBone_ydm0d"]
prev_joint = Vector3(-0.12608, 0.301078, -0.0175054)
next_joint = Vector3(-0.122792, 0.311597, -0.0643308)
width = 0.0162614
rotation = Quaternion(0.104367, -0.0490544, 0.135156, 0.98409)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_ogwky"]
metacarpal = SubResource("UltraleapBone_v81fi")
proximal = SubResource("UltraleapBone_ydm0d")
intermediate = SubResource("UltraleapBone_rs6ku")
distal = SubResource("UltraleapBone_njbt1")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_mjfv2"]
prev_joint = Vector3(-0.0981863, 0.322721, -0.0818725)
next_joint = Vector3(-0.0942372, 0.321043, -0.10215)
width = 0.0154737
rotation = Quaternion(-0.0483095, -0.092182, 0.0804481, 0.991311)
[sub_resource type="UltraleapBone" id="UltraleapBone_fgtvu"]
prev_joint = Vector3(-0.103301, 0.320417, -0.0551639)
next_joint = Vector3(-0.0981863, 0.322721, -0.0818725)
width = 0.0154737
rotation = Quaternion(0.0339073, -0.0976091, 0.0883099, 0.990719)
[sub_resource type="UltraleapBone" id="UltraleapBone_6054x"]
prev_joint = Vector3(-0.123554, 0.287763, 0.0363423)
next_joint = Vector3(-0.108906, 0.305121, -0.0122284)
width = 0.0154737
rotation = Quaternion(0.152741, -0.154097, 0.0866593, 0.972324)
[sub_resource type="UltraleapBone" id="UltraleapBone_8t6pd"]
prev_joint = Vector3(-0.108906, 0.305121, -0.0122284)
next_joint = Vector3(-0.103301, 0.320417, -0.0551639)
width = 0.0154737
rotation = Quaternion(0.162088, -0.0790128, 0.100483, 0.978462)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_13a6u"]
metacarpal = SubResource("UltraleapBone_6054x")
proximal = SubResource("UltraleapBone_8t6pd")
intermediate = SubResource("UltraleapBone_fgtvu")
distal = SubResource("UltraleapBone_mjfv2")
is_extended = true
[sub_resource type="UltraleapBone" id="UltraleapBone_ioju4"]
prev_joint = Vector3(-0.0753368, 0.317045, -0.0522012)
next_joint = Vector3(-0.0701845, 0.315762, -0.0698353)
width = 0.013745
rotation = Quaternion(-0.0308484, -0.142409, -0.0303782, 0.988861)
[sub_resource type="UltraleapBone" id="UltraleapBone_kcl0s"]
prev_joint = Vector3(-0.082763, 0.315923, -0.0300304)
next_joint = Vector3(-0.0753368, 0.317045, -0.0522012)
width = 0.013745
rotation = Quaternion(0.0277465, -0.160199, -0.0213112, 0.986464)
[sub_resource type="UltraleapBone" id="UltraleapBone_vti23"]
prev_joint = Vector3(-0.11179, 0.285911, 0.0386895)
next_joint = Vector3(-0.0931304, 0.305775, -0.00279365)
width = 0.013745
rotation = Quaternion(0.207949, -0.197158, 0.00440616, 0.958053)
[sub_resource type="UltraleapBone" id="UltraleapBone_t12ml"]
prev_joint = Vector3(-0.0931304, 0.305775, -0.00279365)
next_joint = Vector3(-0.082763, 0.315923, -0.0300304)
width = 0.013745
rotation = Quaternion(0.169191, -0.173421, 0.00163838, 0.970205)
[sub_resource type="UltraleapDigit" id="UltraleapDigit_0b63p"]
metacarpal = SubResource("UltraleapBone_vti23")
proximal = SubResource("UltraleapBone_t12ml")
intermediate = SubResource("UltraleapBone_kcl0s")
distal = SubResource("UltraleapBone_ioju4")
is_extended = true
[sub_resource type="UltraleapPalm" id="UltraleapPalm_jit33"]
position = Vector3(-0.124765, 0.291011, -0.00187471)
velocity = Vector3(-0.0324475, 0.0300173, 0.0198487)
normal = Vector3(0.000435379, -0.000836962, -0.00033157)
direction = Vector3(0.000101984, 0.000411793, -0.000905553)
width = 0.0778863
orientation = Quaternion(0.194895, -0.0961224, 0.208649, 0.953542)
[resource]
type = 1
confidence = 1.0
visible_time = 11043603
pinch_distance = 70.5133
grab_angle = 0.569703
thumb = SubResource("UltraleapDigit_pwedm")
index = SubResource("UltraleapDigit_y7156")
middle = SubResource("UltraleapDigit_ogwky")
ring = SubResource("UltraleapDigit_13a6u")
pinky = SubResource("UltraleapDigit_0b63p")
arm = SubResource("UltraleapBone_1icww")
palm = SubResource("UltraleapPalm_jit33")
digits = [SubResource("UltraleapDigit_pwedm"), SubResource("UltraleapDigit_y7156"), SubResource("UltraleapDigit_ogwky"), SubResource("UltraleapDigit_13a6u"), SubResource("UltraleapDigit_0b63p")]

View file

@ -75,6 +75,9 @@ func _process(delta):
var error = ResourceSaver.save(frame.left_hand, "res://LeftHandPose.tres")
if error != OK:
printerr("Failure saving a hand pose")
error = ResourceSaver.save(frame.right_hand, "res://RightHandPose.tres")
if error != OK:
printerr("Failure saving a hand pose")
func set_hand_transform(hand : UltraleapHand, chirality : UltraleapTypes.Chirality):
@ -117,7 +120,7 @@ func set_bone_transform(bone : UltraleapBone, model : Node3D, colour : Color = C
model.global_position = transform_m * pos
# Multiply by quaternion, which is this object rotation, to rotate the hands
model.global_rotation = (quaternion * bone.rotation).get_euler()
model.global_rotation = (quaternion * bone.rotation * Quaternion(Vector3.RIGHT, deg_to_rad(90))).get_euler()
var mesh
var material
@ -128,10 +131,14 @@ func set_bone_transform(bone : UltraleapBone, model : Node3D, colour : Color = C
if model is MeshInstance3D:
mesh = model.mesh
material = model.mesh.material
mesh.size.x = bone.width
mesh.size.z = length
mesh.size.y = 0.01
if mesh is CapsuleMesh:
mesh.radius = bone.width / 2
mesh.height = length
else:
mesh.size.x = bone.width
mesh.size.z = length
mesh.size.y = 0.01
material.albedo_color = colour