Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Collision Hands Demo #478

Closed
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f34da22
added Collision Hands Demo
DigitalN8m4r3 Jul 4, 2023
e3de824
fix gdlint errors
DigitalN8m4r3 Jul 4, 2023
4bac343
added Boxing Dummy model
DigitalN8m4r3 Jul 4, 2023
912074b
added weight 3d models and updated boxing dummy material
DigitalN8m4r3 Jul 6, 2023
a0610e8
updated weight models, added code adjustments to collision hand
DigitalN8m4r3 Jul 6, 2023
2312d0d
added boxing gloves - collision toy
DigitalN8m4r3 Jul 7, 2023
ae4ede4
added punching bag and ball
DigitalN8m4r3 Jul 11, 2023
b88bbf1
added audio to the gloves and a new theme for the demo
DigitalN8m4r3 Jul 11, 2023
87e51a1
added boxing ring to complete the scenery
DigitalN8m4r3 Jul 12, 2023
87ed84c
added the abbility to latch onto interactables
DigitalN8m4r3 Jul 13, 2023
5888b6a
Some restructuring and improvements to collision hands (#6)
BastiaanOlij Jul 18, 2023
1f24e55
added suggested changes - bigger room/ removed blood splatter
DigitalN8m4r3 Jul 18, 2023
f2dd38e
added climbing grips 3d model
DigitalN8m4r3 Jul 19, 2023
9c93a6e
additional changes to the climbing grips
DigitalN8m4r3 Jul 19, 2023
5762a97
requested changes pass 1
DigitalN8m4r3 Jul 28, 2023
3fb7193
changes pass 2 - fix remaining gdlint errors
DigitalN8m4r3 Jul 28, 2023
4dbcd4d
changes pass 3 - gdlint errors
DigitalN8m4r3 Jul 28, 2023
12c09f5
pass 4 - gdlint 7 remaining
DigitalN8m4r3 Jul 28, 2023
40133f5
pass 5 - gdlint
DigitalN8m4r3 Jul 28, 2023
fb3094b
Update collision_hand.gd
DigitalN8m4r3 Jul 28, 2023
d779c37
Update collision_hand.gd
DigitalN8m4r3 Jul 28, 2023
14958df
Merge branch 'master' into collision_hands_demo
DigitalN8m4r3 Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions addons/godot-xr-tools/hands/hand.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ signal hand_scale_changed(scale)
## Last world scale (for scaling hands)
var _last_world_scale : float = 1.0

var _controller : XRController3D

## Initial hand transform (from controller) - used for scaling hands
var _transform : Transform3D

Expand Down Expand Up @@ -90,6 +92,9 @@ func _ready() -> void:
# Save the initial hand transform
_transform = transform

# Find our controller
_controller = XRTools.find_xr_ancestor(self, "*", "XRController3D")

# Find the relevant hand nodes
_hand_mesh = _find_child(self, "MeshInstance3D")
_animation_player = _find_child(self, "AnimationPlayer")
Expand All @@ -116,10 +121,9 @@ func _process(_delta: float) -> void:
emit_signal("hand_scale_changed", _last_world_scale)

# Animate the hand mesh with the controller inputs
var controller : XRController3D = get_parent()
if controller:
var grip : float = controller.get_float(grip_action)
var trigger : float = controller.get_float(trigger_action)
if _controller:
var grip : float = _controller.get_float(grip_action)
var trigger : float = _controller.get_float(trigger_action)

# Allow overriding of grip and trigger
if _force_grip >= 0.0: grip = _force_grip
Expand Down
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions addons/godot-xr-tools/hands/model/Boxing_Glove_L.glb.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[remap]

importer="scene"
importer_version=1
type="PackedScene"
uid="uid://lf3legcgq3r5"
path="res://.godot/imported/Boxing_Glove_L.glb-2aa257630c7df1e061e319e1e5c9f8d5.scn"

[deps]

source_file="res://addons/godot-xr-tools/hands/model/Boxing_Glove_L.glb"
dest_files=["res://.godot/imported/Boxing_Glove_L.glb-2aa257630c7df1e061e319e1e5c9f8d5.scn"]

[params]

nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1
Binary file not shown.
32 changes: 32 additions & 0 deletions addons/godot-xr-tools/hands/model/Boxing_Glove_R.glb.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[remap]

importer="scene"
importer_version=1
type="PackedScene"
uid="uid://c5qmih52i7koq"
path="res://.godot/imported/Boxing_Glove_R.glb-2e583f6a9d1b6ada29a49a9ba1d9a544.scn"

[deps]

source_file="res://addons/godot-xr-tools/hands/model/Boxing_Glove_R.glb"
dest_files=["res://.godot/imported/Boxing_Glove_R.glb-2e583f6a9d1b6ada29a49a9ba1d9a544.scn"]

[params]

nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1
61 changes: 61 additions & 0 deletions addons/godot-xr-tools/hands/scenes/custom/left_boxing_glove.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[gd_scene load_steps=13 format=3 uid="uid://7nsquv3asg0l"]

[ext_resource type="Script" path="res://addons/godot-xr-tools/hands/hand.gd" id="1_y37tm"]
[ext_resource type="AnimationNodeBlendTree" uid="uid://dl8yf7ipqotd1" path="res://addons/godot-xr-tools/hands/animations/left/hand_blend_tree.tres" id="2_8rneq"]
[ext_resource type="Resource" uid="uid://dertgu7k8alls" path="res://addons/godot-xr-tools/hands/poses/pose_default_left.tres" id="3_yo8lr"]
[ext_resource type="PackedScene" uid="uid://lf3legcgq3r5" path="res://addons/godot-xr-tools/hands/model/Boxing_Glove_L.glb" id="4_fd3xs"]
[ext_resource type="Material" uid="uid://ce4m8atbt42h0" path="res://addons/godot-xr-tools/hands/materials/boxing_gloves_blue.material" id="5_yo8xa"]
[ext_resource type="PackedScene" uid="uid://the6y7swe6j0" path="res://addons/godot-xr-tools/hands/animations/left/AnimationPlayer.tscn" id="6_hmoud"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_jefwo"]
animation = &"Grip"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3ev5p"]
animation = &"Grip"

[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_367dj"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_jdlqa"]
animation = &"Grip 5"

[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_f8yrh"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"]

[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_74ypr"]
graph_offset = Vector2(-536, 11)
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_jefwo")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_3ev5p")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_367dj")
nodes/Grip/position = Vector2(0, 20)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_jdlqa")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_f8yrh")
nodes/Trigger/position = Vector2(-360, 20)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]

[node name="LeftHand" type="Node3D"]
script = ExtResource("1_y37tm")
hand_blend_tree = ExtResource("2_8rneq")
default_pose = ExtResource("3_yo8lr")

[node name="Boxing_Glove_L" parent="." instance=ExtResource("4_fd3xs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15)

[node name="mesh_Boxing_Glove_L" parent="Boxing_Glove_L/Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("5_yo8xa")

[node name="AnimationPlayer" parent="Boxing_Glove_L/Armature" index="1" instance=ExtResource("6_hmoud")]

[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource("AnimationNodeBlendTree_74ypr")
anim_player = NodePath("../Boxing_Glove_L/Armature/AnimationPlayer")
active = true
parameters/Grip/blend_amount = 0.0
parameters/Trigger/blend_amount = 0.0

[editable path="Boxing_Glove_L"]
61 changes: 61 additions & 0 deletions addons/godot-xr-tools/hands/scenes/custom/right_boxing_glove.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[gd_scene load_steps=13 format=3 uid="uid://bcdwojrf634qt"]

[ext_resource type="Script" path="res://addons/godot-xr-tools/hands/hand.gd" id="1_4jqcc"]
[ext_resource type="AnimationNodeBlendTree" uid="uid://m85b1gogdums" path="res://addons/godot-xr-tools/hands/animations/right/hand_blend_tree.tres" id="2_5w3g4"]
[ext_resource type="Resource" uid="uid://dmpjtk0l8vh6v" path="res://addons/godot-xr-tools/hands/poses/pose_default_right.tres" id="3_sesm6"]
[ext_resource type="PackedScene" uid="uid://bxipj7hyjwy6f" path="res://addons/godot-xr-tools/hands/animations/right/AnimationPlayer.tscn" id="6_0axct"]
[ext_resource type="PackedScene" uid="uid://c5qmih52i7koq" path="res://addons/godot-xr-tools/hands/model/Boxing_Glove_R.glb" id="7_q5gof"]
[ext_resource type="Material" uid="uid://ce4m8atbt42h0" path="res://addons/godot-xr-tools/hands/materials/boxing_gloves_blue.material" id="8_0prnb"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ssi0w"]
animation = &"Grip"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hq5ia"]
animation = &"Grip"

[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_1qlga"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_fu75d"]
animation = &"Grip 5"

[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ffepe"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"]

[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_vhdjk"]
graph_offset = Vector2(-552.664, 107.301)
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_ssi0w")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_hq5ia")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_1qlga")
nodes/Grip/position = Vector2(0, 40)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_fu75d")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_ffepe")
nodes/Trigger/position = Vector2(-360, 40)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]

[node name="RightHand" type="Node3D"]
script = ExtResource("1_4jqcc")
hand_blend_tree = ExtResource("2_5w3g4")
default_pose = ExtResource("3_sesm6")

[node name="Boxing_Glove_R" parent="." instance=ExtResource("7_q5gof")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15)

[node name="mesh_Boxing_Glove_R" parent="Boxing_Glove_R/Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("8_0prnb")

[node name="AnimationPlayer" parent="Boxing_Glove_R/Armature" index="1" instance=ExtResource("6_0axct")]

[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource("AnimationNodeBlendTree_vhdjk")
anim_player = NodePath("../Boxing_Glove_R/Armature/AnimationPlayer")
active = true
parameters/Grip/blend_amount = 0.0
parameters/Trigger/blend_amount = 0.0

[editable path="Boxing_Glove_R"]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://d1xotjiwaftsw"
path.s3tc="res://.godot/imported/boxing_glove_blue_baseColor.png-8f5fc5a230c245a34b9838409cd06520.s3tc.ctex"
path.etc2="res://.godot/imported/boxing_glove_blue_baseColor.png-8f5fc5a230c245a34b9838409cd06520.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}

[deps]

source_file="res://addons/godot-xr-tools/hands/textures/boxing_glove_blue_baseColor.png"
dest_files=["res://.godot/imported/boxing_glove_blue_baseColor.png-8f5fc5a230c245a34b9838409cd06520.s3tc.ctex", "res://.godot/imported/boxing_glove_blue_baseColor.png-8f5fc5a230c245a34b9838409cd06520.etc2.ctex"]

[params]

compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://ce2531mhgkwuf"
path.s3tc="res://.godot/imported/boxing_glove_normal.png-ceff99e953e1dd78ec32d80f7ee6c91f.s3tc.ctex"
path.etc2="res://.godot/imported/boxing_glove_normal.png-ceff99e953e1dd78ec32d80f7ee6c91f.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}

[deps]

source_file="res://addons/godot-xr-tools/hands/textures/boxing_glove_normal.png"
dest_files=["res://.godot/imported/boxing_glove_normal.png-ceff99e953e1dd78ec32d80f7ee6c91f.s3tc.ctex", "res://.godot/imported/boxing_glove_normal.png-ceff99e953e1dd78ec32d80f7ee6c91f.etc2.ctex"]

[params]

compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/digitaln8m4r3/textures/boxing_glove_normal.png"
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dttbm3eklweue"
path.s3tc="res://.godot/imported/boxing_glove_occlusionRoughnessMetallic.png-70c884bb1b7bccb1731812cfdf5d4bc9.s3tc.ctex"
path.etc2="res://.godot/imported/boxing_glove_occlusionRoughnessMetallic.png-70c884bb1b7bccb1731812cfdf5d4bc9.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}

[deps]

source_file="res://addons/godot-xr-tools/hands/textures/boxing_glove_occlusionRoughnessMetallic.png"
dest_files=["res://.godot/imported/boxing_glove_occlusionRoughnessMetallic.png-70c884bb1b7bccb1731812cfdf5d4bc9.s3tc.ctex", "res://.godot/imported/boxing_glove_occlusionRoughnessMetallic.png-70c884bb1b7bccb1731812cfdf5d4bc9.etc2.ctex"]

[params]

compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
23 changes: 22 additions & 1 deletion addons/godot-xr-tools/interactables/interactable_handle.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ extends XRToolsPickable
## Distance from the handle origin to auto-snap the grab
@export var snap_distance : float = 0.3

@export_group("Optional attach Hand")
## this latches the grabbing Hand onto the Interactable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of '##' (API Documentation Comments) produces some really funky online documentation.
image

If this is just documentation for developers, you may want to use the '#' style of comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking a look at this, wasnt aware that this would actualy produce this kind of mess.
gonna look into it and remove unecassary comments.

## ________________________________________________________
## Requirement: Collision Hands
## ________________________________________________________
## Additional Note:
## ________________________________________________________
## if export paths are not set, this will be ignored
## so make sure to setup the paths corresponding to hand
## Example: left_hand_position = LeftHandMarker3D
@export var left_hand_position : Marker3D
## Requirement: Collision Hands
@export var right_hand_position : Marker3D


# Handle origin spatial node
@onready var handle_origin: Node3D = get_parent()
Expand Down Expand Up @@ -61,7 +75,11 @@ func _process(_delta: float) -> void:
func pick_up(by, with_controller) -> void:
# Call the base-class to perform the pickup
super(by, with_controller)

if left_hand_position:
if with_controller.name.matchn("*left*"):
left_hand_position.get_node("RemoteTransform3D").remote_path = self.by_hand.get_path()
else:
right_hand_position.get_node("RemoteTransform3D").remote_path = self.by_hand.get_path()
# Enable the process function while held
set_process(true)

Expand All @@ -70,6 +88,9 @@ func pick_up(by, with_controller) -> void:
func let_go(_p_linear_velocity: Vector3, _p_angular_velocity: Vector3) -> void:
# Call the base-class to perform the drop, but with no velocity
super(Vector3.ZERO, Vector3.ZERO)
if left_hand_position:
left_hand_position.get_node("RemoteTransform3D").remote_path = ""
right_hand_position.get_node("RemoteTransform3D").remote_path = ""

# Disable the process function as no-longer held
set_process(false)
Expand Down
Loading