From 460ddd9efe298686e50aa26f8ebdc124d992538a Mon Sep 17 00:00:00 2001 From: squid Date: Sat, 16 Nov 2024 23:09:25 -0700 Subject: [PATCH 1/6] Add a private transform to handle_driven Used to keep track of an 'original' transform before 'driven' changes are made. For example 'slider_position' or 'hinge_position' being changed due to handle movement. --- .../interactable_handle_driven.gd | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/addons/godot-xr-tools/interactables/interactable_handle_driven.gd b/addons/godot-xr-tools/interactables/interactable_handle_driven.gd index f9f5358e..f2f00c89 100644 --- a/addons/godot-xr-tools/interactables/interactable_handle_driven.gd +++ b/addons/godot-xr-tools/interactables/interactable_handle_driven.gd @@ -24,13 +24,18 @@ signal released(interactable) var grabbed_handles := Array() -# Add support for is_xr_class on XRTools classes -func is_xr_class(name : String) -> bool: - return name == "XRToolsInteractableHandleDriven" +## Transform3D that ignores driven behavior +var _private_transform : Transform3D +var _is_driven_change := false + + +func _enter_tree() -> void: + set_notify_local_transform(true) -# Called when the node enters the scene tree for the first time. func _ready(): + _private_transform = transform + # Hook picked_up and dropped signals from all child handles _hook_child_handles(self) @@ -38,6 +43,19 @@ func _ready(): set_process(false) +func _notification(what: int) -> void: + if what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED: + # If change NOT from driven behavior + if !_is_driven_change: + _private_transform = transform + _is_driven_change = false + + +# Add support for is_xr_class on XRTools classes +func is_xr_class(name : String) -> bool: + return name == "XRToolsInteractableHandleDriven" + + # Called when a handle is picked up func _on_handle_picked_up(handle: XRToolsInteractableHandle) -> void: # Append to the list of grabbed handles From b1641d73a11ab521d68375d756eda0fe53b78f06 Mon Sep 17 00:00:00 2001 From: squid Date: Sat, 16 Nov 2024 23:16:17 -0700 Subject: [PATCH 2/6] Add private transform functionality for hinge - Remove shadowed variable names --- .../interactables/interactable_hinge.gd | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/addons/godot-xr-tools/interactables/interactable_hinge.gd b/addons/godot-xr-tools/interactables/interactable_hinge.gd index ce774a53..0120f15f 100644 --- a/addons/godot-xr-tools/interactables/interactable_hinge.gd +++ b/addons/godot-xr-tools/interactables/interactable_hinge.gd @@ -37,6 +37,10 @@ signal hinge_moved(angle) ## If true, the hinge moves to the default position when releases @export var default_on_release : bool = false +## Set to rotate about this local axis +@export var hinge_axis := Vector3.RIGHT: + set(v): + hinge_axis = v.normalized() # Hinge values in radians @onready var _hinge_limit_min_rad : float = deg_to_rad(hinge_limit_min) @@ -56,12 +60,6 @@ func _ready(): # In Godot 4 we must now manually call our super class ready function super() - # Set the initial position to match the initial hinge position value - transform = Transform3D( - Basis.from_euler(Vector3(_hinge_position_rad, 0, 0)), - Vector3.ZERO - ) - # Connect signals if released.connect(_on_hinge_released): push_error("Cannot connect hinge released signal") @@ -73,11 +71,15 @@ func _process(_delta: float) -> void: var offset_sum := 0.0 for item in grabbed_handles: var handle := item as XRToolsInteractableHandle - var to_handle: Vector3 = handle.global_transform.origin * global_transform - var to_handle_origin: Vector3 = handle.handle_origin.global_transform.origin * global_transform - to_handle.x = 0.0 - to_handle_origin.x = 0.0 - offset_sum += to_handle_origin.signed_angle_to(to_handle, Vector3.RIGHT) + # global handle + handle_origin position + var axis := get_final_axis() + var to_handle : Vector3 = handle.global_transform.origin * global_transform + var to_handle_origin : Vector3 = handle.handle_origin.global_transform.origin * global_transform + var a_old = to_handle_origin.signed_angle_to(to_handle, axis) + + # project 'to_handle' and 'to_handle_origin' on 'axis' + # then measure the angle + offset_sum += atan2(to_handle_origin.cross(to_handle).dot(axis), to_handle.dot(to_handle_origin)) # Average the angular offsets var offset := offset_sum / grabbed_handles.size() @@ -86,6 +88,11 @@ func _process(_delta: float) -> void: move_hinge(_hinge_position_rad + offset) +## Return a unit vector of the final rotation axis +func get_final_axis() -> Vector3: + return (hinge_axis * _private_transform.basis.inverse()).normalized() + + # Move the hinge to the specified position func move_hinge(position: float) -> void: # Do the hinge move @@ -98,7 +105,7 @@ func move_hinge(position: float) -> void: hinge_position = rad_to_deg(position) # Emit the moved signal - emit_signal("hinge_moved", hinge_position) + hinge_moved.emit(hinge_position) # Handle release of hinge @@ -127,10 +134,12 @@ func _set_hinge_steps(value: float) -> void: # Called when hinge_position is set externally func _set_hinge_position(value: float) -> void: - var position := deg_to_rad(value) - position = _do_move_hinge(position) - hinge_position = rad_to_deg(position) - _hinge_position_rad = position + + _is_driven_change = true + var rads := deg_to_rad(value) + rads = _do_move_hinge(rads) + hinge_position = rad_to_deg(rads) + _hinge_position_rad = rads # Called when default_position is set externally @@ -140,17 +149,18 @@ func _set_default_position(value: float) -> void: # Do the hinge move -func _do_move_hinge(position: float) -> float: +func _do_move_hinge(_angle_radians: float) -> float: # Apply hinge step-quantization if _hinge_steps_rad: - position = round(position / _hinge_steps_rad) * _hinge_steps_rad + _angle_radians = round(_angle_radians / _hinge_steps_rad) * _hinge_steps_rad # Apply hinge limits - position = clamp(position, _hinge_limit_min_rad, _hinge_limit_max_rad) + _angle_radians = clamp(_angle_radians, _hinge_limit_min_rad, _hinge_limit_max_rad) # Move if necessary - if position != _hinge_position_rad: - transform.basis = Basis.from_euler(Vector3(position, 0.0, 0.0)) + if _angle_radians != _hinge_position_rad: + _is_driven_change = true + transform = _private_transform.rotated_local(get_final_axis(), _angle_radians) - # Return the updated position - return position + # Return the updated _angle_radians + return _angle_radians From e582af4900c095644d7701e96ed64e4613eb31f7 Mon Sep 17 00:00:00 2001 From: squid Date: Sat, 16 Nov 2024 23:34:49 -0700 Subject: [PATCH 3/6] Add private transform functionality for slider - Removed shadowed variable names --- .../interactables/interactable_slider.gd | 132 ++++++++---------- 1 file changed, 58 insertions(+), 74 deletions(-) diff --git a/addons/godot-xr-tools/interactables/interactable_slider.gd b/addons/godot-xr-tools/interactables/interactable_slider.gd index 5faf517e..567945f9 100644 --- a/addons/godot-xr-tools/interactables/interactable_slider.gd +++ b/addons/godot-xr-tools/interactables/interactable_slider.gd @@ -5,31 +5,60 @@ extends XRToolsInteractableHandleDriven ## XR Tools Interactable Slider script ## -## The interactable slider is a slider transform node controlled by the -## player through [XRToolsInteractableHandle] instances. +## A transform node controlled by the user through [XRToolsInteractableHandle] instances. ## -## The slider translates itelf along its local X axis, and so should be -## placed as a child of a node to translate and rotate as appropriate. +## An example scene may be setup in the following way: +## XRSlider +## SliderModel (A Firearm Bolt, or Door Handle) +## GrabPointHandLeft +## InteractableHandle +## CollisionShape3D +## GrabPointRedirectLeft (set to 'GrabPointHandLeft') ## ## The interactable slider is not a [RigidBody3D], and as such will not react ## to any collisions. -## Signal for slider moved -signal slider_moved(position) +signal slider_moved(offset: float) -## Slider minimum limit -@export var slider_limit_min : float = 0.0 +## Start position for slide, can be positiv and negativ in values +@export var slider_limit_min : float = 0.0: + set(v): + slider_limit_min = minf(v, slider_limit_max) + slider_position = slider_position -## Slider maximum limit -@export var slider_limit_max : float = 1.0 +## End position for slide, can be positiv and negativ in values +@export var slider_limit_max : float = 1.0: + set(v): + slider_limit_max = maxf(v, slider_limit_min) + slider_position = slider_position +## Signal for slider moved ## Slider step size (zero for no steps) -@export var slider_steps : float = 0.0 - -## Slider position -@export var slider_position : float = 0.0: set = _set_slider_position +@export var slider_steps : float = 0.0: + set(v): + slider_steps = maxf(v, 0) + +## Slider position - move to test the position setup +@export var slider_position : float = 0.0: + set(v): + # Apply slider step-quantization + if !is_zero_approx(slider_steps): + v = roundf(v / slider_steps) * slider_steps + + # Clamp position + v = clampf(v, slider_limit_min, slider_limit_max) + + # No change + if is_equal_approx(slider_position, v): + return + + # Set, Emit + _is_driven_change = true + position = _private_transform.origin - (v * get_slider_direction()) + slider_position = v + slider_moved.emit(v) ## Default position @export var default_position : float = 0.0 @@ -39,82 +68,37 @@ signal slider_moved(position) # Add support for is_xr_class on XRTools classes -func is_xr_class(name : String) -> bool: - return name == "XRToolsInteractableSlider" or super(name) +func is_xr_class(_name : String) -> bool: + return _name == "XRToolsInteractableSlider" or super(_name) -# Called when the node enters the scene tree for the first time. func _ready() -> void: - # In Godot 4 we must now manually call our super class ready function super() - # Set the initial position to match the initial slider position value - transform = Transform3D( - Basis.IDENTITY, - Vector3(slider_position, 0.0, 0.0) - ) - # Connect signals - if released.connect(_on_slider_released): + if released.connect(_on_released): push_error("Cannot connect slider released signal") -# Called every frame when one or more handles are held by the player func _process(_delta: float) -> void: + if grabbed_handles.is_empty(): + return + # Get the total handle offsets - var offset_sum := Vector3.ZERO + var offset_sum := 0.0 for item in grabbed_handles: var handle := item as XRToolsInteractableHandle - offset_sum += handle.global_transform.origin - handle.handle_origin.global_transform.origin - - # Rotate the offset sum vector from global into local coordinate space - offset_sum = offset_sum * global_transform.basis - - # Get the average displacement in the X axis - var offset := offset_sum.x / grabbed_handles.size() - - # Move the slider by the requested offset - move_slider(slider_position + offset) + var hlocal := to_local(handle.global_position) + offset_sum = hlocal.dot(get_slider_direction()) + slider_position -= offset_sum / grabbed_handles.size() -# Move the slider to the specified position -func move_slider(position: float) -> void: - # Do the slider move - position = _do_move_slider(position) - if position == slider_position: - return - - # Update the current position - slider_position = position - # Emit the moved signal - emit_signal("slider_moved", position) +## Returns a Unit Vector3 pointing backwards relative to the current transform +func get_slider_direction() -> Vector3: + return (Vector3.BACK * _private_transform.basis.inverse()).normalized() -# Handle release of slider -func _on_slider_released(_interactable: XRToolsInteractableSlider): +func _on_released(_interactable: Variant) -> void: if default_on_release: - move_slider(default_position) - - -# Called when the slider position is set externally -func _set_slider_position(position: float) -> void: - position = _do_move_slider(position) - slider_position = position - - -# Do the slider move -func _do_move_slider(position: float) -> float: - # Apply slider step-quantization - if slider_steps: - position = round(position / slider_steps) * slider_steps - - # Apply slider limits - position = clamp(position, slider_limit_min, slider_limit_max) - - # Move if necessary - if position != slider_position: - transform.origin.x = position - - # Return the updated position - return position + slider_position = default_position From bd605c8fad11b2efe5e2ff5576c1c91fe0808140 Mon Sep 17 00:00:00 2001 From: squid Date: Fri, 22 Nov 2024 23:33:32 -0700 Subject: [PATCH 4/6] Fix slider math --- .../interactables/interactable_slider.gd | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/godot-xr-tools/interactables/interactable_slider.gd b/addons/godot-xr-tools/interactables/interactable_slider.gd index 567945f9..c70f4850 100644 --- a/addons/godot-xr-tools/interactables/interactable_slider.gd +++ b/addons/godot-xr-tools/interactables/interactable_slider.gd @@ -88,15 +88,21 @@ func _process(_delta: float) -> void: var offset_sum := 0.0 for item in grabbed_handles: var handle := item as XRToolsInteractableHandle - var hlocal := to_local(handle.global_position) - offset_sum = hlocal.dot(get_slider_direction()) + var to_handle : Vector3 = to_local(handle.global_position) * _private_transform.basis.inverse() + var to_handle_origin : Vector3 = to_local(handle.handle_origin.global_position) * _private_transform + var dot1 = to_handle.dot(get_slider_direction()) + var dot2 = to_handle_origin.dot(get_slider_direction()) + + # Subtracting these two dot products ensures that movement is relative to + # handle_origin instead of the slider's origin + offset_sum += dot1-dot2 slider_position -= offset_sum / grabbed_handles.size() ## Returns a Unit Vector3 pointing backwards relative to the current transform func get_slider_direction() -> Vector3: - return (Vector3.BACK * _private_transform.basis.inverse()).normalized() + return (Vector3.BACK * _private_transform.basis.inverse()).normalized() func _on_released(_interactable: Variant) -> void: From 4c7e4666835e68bd6a3d7fe4888c3034199e7e5b Mon Sep 17 00:00:00 2001 From: squid Date: Wed, 27 Nov 2024 17:43:16 -0700 Subject: [PATCH 5/6] Setup 'interactables_demo' --- .../meshes/interactables/joystick_smooth.tscn | 37 ++- .../meshes/interactables/joystick_snap.tscn | 37 ++- .../meshes/interactables/joystick_zero.tscn | 37 ++- assets/meshes/interactables/lever_smooth.tscn | 30 ++- assets/meshes/interactables/lever_snap.tscn | 38 ++- assets/meshes/interactables/lever_zero.tscn | 38 ++- .../meshes/interactables/slider_smooth.tscn | 42 ++-- assets/meshes/interactables/slider_snap.tscn | 82 ++++--- assets/meshes/interactables/slider_zero.tscn | 82 ++++--- assets/meshes/interactables/wheel_smooth.tscn | 97 ++++---- .../interactables_demo.tscn | 221 +++++++++++++++--- 11 files changed, 436 insertions(+), 305 deletions(-) diff --git a/assets/meshes/interactables/joystick_smooth.tscn b/assets/meshes/interactables/joystick_smooth.tscn index 9ef50865..836459a3 100644 --- a/assets/meshes/interactables/joystick_smooth.tscn +++ b/assets/meshes/interactables/joystick_smooth.tscn @@ -42,7 +42,7 @@ script = ExtResource("6_fogq8") open_pose = ExtResource("8_vbsbw") closed_pose = ExtResource("8_vbsbw") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_opb5a"] margin = 0.12 radius = 0.06 @@ -57,54 +57,49 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="JoystickOrigin" type="Node3D" parent="."] -transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableJoystick" type="Node3D" parent="JoystickOrigin"] +[node name="InteractableJoystick" type="Node3D" parent="."] script = ExtResource("2") -[node name="JoystickBody" type="StaticBody3D" parent="JoystickOrigin/InteractableJoystick"] +[node name="JoystickBody" type="StaticBody3D" parent="InteractableJoystick"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_dxrni")] +[node name="GrabPointHandLeft" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_dxrni")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_b7ph4") -[node name="GrabPointHandRight" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("5_xdnkf")] +[node name="GrabPointHandRight" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("5_xdnkf")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_2v03l") -[node name="HandleOrigin" type="Node3D" parent="JoystickOrigin/InteractableJoystick"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableJoystick"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableJoystick/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableJoystick/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_opb5a") -[node name="GrabPointRedirectLeft" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_yqm2n")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_yqm2n")] -[node name="GrabPointRedirectRight" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_yqm2n")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_yqm2n")] diff --git a/assets/meshes/interactables/joystick_snap.tscn b/assets/meshes/interactables/joystick_snap.tscn index c6bd31ce..b1f67e6d 100644 --- a/assets/meshes/interactables/joystick_snap.tscn +++ b/assets/meshes/interactables/joystick_snap.tscn @@ -42,7 +42,7 @@ script = ExtResource("6_ni3r3") open_pose = ExtResource("8_hhwxc") closed_pose = ExtResource("8_hhwxc") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_etvag"] margin = 0.12 radius = 0.06 @@ -57,56 +57,51 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="JoystickOrigin" type="Node3D" parent="."] -transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableJoystick" type="Node3D" parent="JoystickOrigin"] +[node name="InteractableJoystick" type="Node3D" parent="."] script = ExtResource("2") joystick_x_steps = 5.0 joystick_y_steps = 5.0 -[node name="JoystickBody" type="StaticBody3D" parent="JoystickOrigin/InteractableJoystick"] +[node name="JoystickBody" type="StaticBody3D" parent="InteractableJoystick"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_0rs04")] +[node name="GrabPointHandLeft" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_0rs04")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_xmm1u") -[node name="GrabPointHandRight" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("7_71xbx")] +[node name="GrabPointHandRight" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("7_71xbx")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_qfirj") -[node name="HandleOrigin" type="Node3D" parent="JoystickOrigin/InteractableJoystick"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableJoystick"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableJoystick/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableJoystick/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_etvag") -[node name="GrabPointRedirectLeft" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_lhgvx")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_lhgvx")] -[node name="GrabPointRedirectRight" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_lhgvx")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_lhgvx")] diff --git a/assets/meshes/interactables/joystick_zero.tscn b/assets/meshes/interactables/joystick_zero.tscn index 070a1e45..16460e9d 100644 --- a/assets/meshes/interactables/joystick_zero.tscn +++ b/assets/meshes/interactables/joystick_zero.tscn @@ -42,7 +42,7 @@ script = ExtResource("6_ve8n7") open_pose = ExtResource("8_4ywv1") closed_pose = ExtResource("8_4ywv1") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_ovvxh"] margin = 0.12 radius = 0.06 @@ -57,55 +57,50 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="JoystickOrigin" type="Node3D" parent="."] -transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableJoystick" type="Node3D" parent="JoystickOrigin"] +[node name="InteractableJoystick" type="Node3D" parent="."] script = ExtResource("2") default_on_release = true -[node name="JoystickBody" type="StaticBody3D" parent="JoystickOrigin/InteractableJoystick"] +[node name="JoystickBody" type="StaticBody3D" parent="InteractableJoystick"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="JoystickOrigin/InteractableJoystick/JoystickBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableJoystick/JoystickBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_i88vc")] +[node name="GrabPointHandLeft" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("4_i88vc")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_ouraf") -[node name="GrabPointHandRight" parent="JoystickOrigin/InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("7_k3kr4")] +[node name="GrabPointHandRight" parent="InteractableJoystick/JoystickBody/HandleMesh" instance=ExtResource("7_k3kr4")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_upq8k") -[node name="HandleOrigin" type="Node3D" parent="JoystickOrigin/InteractableJoystick"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableJoystick"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableJoystick/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableJoystick/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_ovvxh") -[node name="GrabPointRedirectLeft" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_j1gnl")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_j1gnl")] -[node name="GrabPointRedirectRight" parent="JoystickOrigin/InteractableJoystick/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_j1gnl")] -target = NodePath("../../../JoystickBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableJoystick/HandleOrigin/InteractableHandle" instance=ExtResource("10_j1gnl")] diff --git a/assets/meshes/interactables/lever_smooth.tscn b/assets/meshes/interactables/lever_smooth.tscn index 2a209d72..99d4dac7 100644 --- a/assets/meshes/interactables/lever_smooth.tscn +++ b/assets/meshes/interactables/lever_smooth.tscn @@ -57,54 +57,52 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="LeverOrigin" type="Node3D" parent="."] +[node name="InteractableLever" type="Node3D" parent="."] transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableLever" type="Node3D" parent="LeverOrigin"] script = ExtResource("2") -[node name="HingeBody" type="StaticBody3D" parent="LeverOrigin/InteractableLever"] +[node name="HingeBody" type="StaticBody3D" parent="InteractableLever"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_psbg5")] +[node name="GrabPointHandLeft" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_psbg5")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_v6sel") -[node name="GrabPointHandRight" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_xphfh")] +[node name="GrabPointHandRight" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_xphfh")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_t7yav") -[node name="HandleOrigin" type="Node3D" parent="LeverOrigin/InteractableLever"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableLever"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="LeverOrigin/InteractableLever/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableLever/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableLever/HandleOrigin/InteractableHandle"] shape = SubResource("7") -[node name="GrabPointRedirectLeft" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_2yftn")] +[node name="GrabPointRedirectLeft" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_2yftn")] target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandLeft") -[node name="GrabPointRedirectRight" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_2yftn")] +[node name="GrabPointRedirectRight" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_2yftn")] target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandRight") diff --git a/assets/meshes/interactables/lever_snap.tscn b/assets/meshes/interactables/lever_snap.tscn index c84d225d..964ed876 100644 --- a/assets/meshes/interactables/lever_snap.tscn +++ b/assets/meshes/interactables/lever_snap.tscn @@ -42,7 +42,7 @@ script = ExtResource("6_witby") open_pose = ExtResource("8_mqbal") closed_pose = ExtResource("8_mqbal") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_vdvjr"] margin = 0.12 radius = 0.06 @@ -57,55 +57,53 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="LeverOrigin" type="Node3D" parent="."] +[node name="InteractableLever" type="Node3D" parent="."] transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableLever" type="Node3D" parent="LeverOrigin"] script = ExtResource("2") hinge_steps = 5.0 -[node name="HingeBody" type="StaticBody3D" parent="LeverOrigin/InteractableLever"] +[node name="HingeBody" type="StaticBody3D" parent="InteractableLever"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_ia5nn")] +[node name="GrabPointHandLeft" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_ia5nn")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_6lx1a") -[node name="GrabPointHandRight" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_s7ik7")] +[node name="GrabPointHandRight" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_s7ik7")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_0fga0") -[node name="HandleOrigin" type="Node3D" parent="LeverOrigin/InteractableLever"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableLever"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="LeverOrigin/InteractableLever/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableLever/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableLever/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_vdvjr") -[node name="GrabPointRedirectLeft" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_4bxwn")] -target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_4bxwn")] +target = NodePath("") -[node name="GrabPointRedirectRight" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_4bxwn")] -target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_4bxwn")] +target = NodePath("") diff --git a/assets/meshes/interactables/lever_zero.tscn b/assets/meshes/interactables/lever_zero.tscn index a6e477b0..8fc6ddb2 100644 --- a/assets/meshes/interactables/lever_zero.tscn +++ b/assets/meshes/interactables/lever_zero.tscn @@ -42,7 +42,7 @@ script = ExtResource("6_nyol8") open_pose = ExtResource("8_otwuk") closed_pose = ExtResource("8_otwuk") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_l5nj7"] margin = 0.12 radius = 0.06 @@ -57,55 +57,53 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="LeverOrigin" type="Node3D" parent="."] +[node name="InteractableLever" type="Node3D" parent="."] transform = Transform3D(1, -1.06581e-14, 0, 1.06581e-14, 1, 0, 0, 0, 1, 0, 0, 0) - -[node name="InteractableLever" type="Node3D" parent="LeverOrigin"] script = ExtResource("2") default_on_release = true -[node name="HingeBody" type="StaticBody3D" parent="LeverOrigin/InteractableLever"] +[node name="HingeBody" type="StaticBody3D" parent="InteractableLever"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -[node name="BarCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="LeverOrigin/InteractableLever/HingeBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableLever/HingeBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_lu2nr")] +[node name="GrabPointHandLeft" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("4_lu2nr")] transform = Transform3D(-4.37114e-08, 1, -7.53641e-15, -0.707107, -3.09086e-08, -0.707107, -0.707107, -3.09086e-08, 0.707107, 0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_87asn") -[node name="GrabPointHandRight" parent="LeverOrigin/InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_xbqs6")] +[node name="GrabPointHandRight" parent="InteractableLever/HingeBody/HandleMesh" instance=ExtResource("7_xbqs6")] transform = Transform3D(-4.37114e-08, -1, -1.02355e-14, 0.642788, -2.80971e-08, -0.766044, 0.766044, -3.34849e-08, 0.642788, -0.05, 0.0759278, -0.0419973) hand_pose = SubResource("Resource_7yemt") -[node name="HandleOrigin" type="Node3D" parent="LeverOrigin/InteractableLever"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableLever"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.200422) -[node name="InteractableHandle" type="RigidBody3D" parent="LeverOrigin/InteractableLever/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableLever/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableLever/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_l5nj7") -[node name="GrabPointRedirectLeft" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_23ntw")] -target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_23ntw")] +target = NodePath("") -[node name="GrabPointRedirectRight" parent="LeverOrigin/InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_23ntw")] -target = NodePath("../../../HingeBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableLever/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_23ntw")] +target = NodePath("") diff --git a/assets/meshes/interactables/slider_smooth.tscn b/assets/meshes/interactables/slider_smooth.tscn index 03b8cec2..7f84177e 100644 --- a/assets/meshes/interactables/slider_smooth.tscn +++ b/assets/meshes/interactables/slider_smooth.tscn @@ -57,58 +57,56 @@ shape = SubResource("1") mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="SliderOrigin" type="Node3D" parent="."] -transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, -0.2, 0) - -[node name="InteractableSlider" type="Node3D" parent="SliderOrigin"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0) +[node name="InteractableSlider" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) script = ExtResource("2") -slider_limit_max = 0.4 -slider_position = 0.2 -default_position = 0.2 +slider_limit_min = -0.2 +slider_limit_max = 0.2 -[node name="SliderBody" type="StaticBody3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) +[node name="SliderBody" type="StaticBody3D" parent="InteractableSlider"] +transform = Transform3D(-4.37114e-08, -1, 4.37114e-08, 0, -4.37114e-08, -1, 1, -4.37114e-08, 3.55271e-15, 0, -0.149944, -6.55426e-09) -[node name="BarCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="BarCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] shape = SubResource("3") -[node name="HandleCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) shape = SubResource("4") -[node name="BarMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="BarMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] mesh = SubResource("5") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) mesh = SubResource("6") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_klojw")] +[node name="GrabPointHandLeft" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_klojw")] transform = Transform3D(-0.707107, -7.462e-08, -0.707107, 7.462e-08, -1, 3.09086e-08, -0.707107, -3.09086e-08, 0.707107, 0.0760452, -0.0474728, -0.0419973) +visible = true hand_pose = SubResource("Resource_gwrxt") -[node name="GrabPointHandRight" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_iigvs")] +[node name="GrabPointHandRight" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_iigvs")] transform = Transform3D(0.642788, 1.56143e-08, -0.766044, 1.56143e-08, 1, 3.34849e-08, 0.766044, -3.34849e-08, 0.642788, 0.0760452, 0.0525272, -0.0419973) +visible = true hand_pose = SubResource("Resource_4gr4w") -[node name="HandleOrigin" type="Node3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableSlider"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.248697, -1.08709e-08) -[node name="InteractableHandle" type="RigidBody3D" parent="SliderOrigin/InteractableSlider/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableSlider/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableSlider/HandleOrigin/InteractableHandle"] shape = SubResource("7") -[node name="GrabPointRedirectLeft" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_boasd")] +[node name="GrabPointRedirectLeft" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_boasd")] target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandLeft") -[node name="GrabPointRedirectRight" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_boasd")] +[node name="GrabPointRedirectRight" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_boasd")] target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandRight") diff --git a/assets/meshes/interactables/slider_snap.tscn b/assets/meshes/interactables/slider_snap.tscn index b1daf743..08a2930c 100644 --- a/assets/meshes/interactables/slider_snap.tscn +++ b/assets/meshes/interactables/slider_snap.tscn @@ -11,38 +11,38 @@ [ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="8_3u4ai"] [ext_resource type="PackedScene" uid="uid://ca3daqmpo0tua" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_redirect.tscn" id="10_5fki7"] -[sub_resource type="BoxShape3D" id="1"] +[sub_resource type="BoxShape3D" id="BoxShape3D_1hfpe"] size = Vector3(0.2, 0.6, 0.1) -[sub_resource type="BoxMesh" id="2"] +[sub_resource type="BoxMesh" id="BoxMesh_j83a4"] size = Vector3(0.2, 0.6, 0.1) -[sub_resource type="BoxShape3D" id="3"] +[sub_resource type="BoxShape3D" id="BoxShape3D_t0ar7"] size = Vector3(0.04, 0.04, 0.2) -[sub_resource type="SphereShape3D" id="4"] +[sub_resource type="SphereShape3D" id="SphereShape3D_tij10"] radius = 0.06 -[sub_resource type="BoxMesh" id="5"] +[sub_resource type="BoxMesh" id="BoxMesh_3mkeh"] size = Vector3(0.04, 0.04, 0.2) -[sub_resource type="SphereMesh" id="6"] +[sub_resource type="SphereMesh" id="SphereMesh_37rqd"] radius = 0.06 height = 0.12 radial_segments = 16 rings = 8 -[sub_resource type="Resource" id="Resource_oadqy"] +[sub_resource type="Resource" id="Resource_uvugh"] script = ExtResource("6_msqk3") open_pose = ExtResource("5_t5q1b") closed_pose = ExtResource("5_t5q1b") -[sub_resource type="Resource" id="Resource_6ggfb"] +[sub_resource type="Resource" id="Resource_4ye2w"] script = ExtResource("6_msqk3") open_pose = ExtResource("8_3u4ai") closed_pose = ExtResource("8_3u4ai") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_vhodf"] margin = 0.12 radius = 0.06 @@ -51,65 +51,63 @@ radius = 0.06 [node name="Frame" type="StaticBody3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="Frame"] -shape = SubResource("1") +shape = SubResource("BoxShape3D_1hfpe") [node name="MeshInstance3D" type="MeshInstance3D" parent="Frame"] -mesh = SubResource("2") +mesh = SubResource("BoxMesh_j83a4") surface_material_override/0 = ExtResource("1") -[node name="SliderOrigin" type="Node3D" parent="."] -transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, -0.2, 0) - -[node name="InteractableSlider" type="Node3D" parent="SliderOrigin"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0) +[node name="InteractableSlider" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) script = ExtResource("2") -slider_limit_max = 0.4 +slider_limit_min = -0.2 +slider_limit_max = 0.2 slider_steps = 0.1 -slider_position = 0.2 -default_position = 0.2 -[node name="SliderBody" type="StaticBody3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) +[node name="SliderBody" type="StaticBody3D" parent="InteractableSlider"] +transform = Transform3D(-4.37114e-08, -1, 4.37114e-08, 0, -4.37114e-08, -1, 1, -4.37114e-08, 3.55271e-15, 0, -0.149944, -6.55426e-09) -[node name="BarCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] -shape = SubResource("3") +[node name="BarCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] +shape = SubResource("BoxShape3D_t0ar7") -[node name="HandleCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -shape = SubResource("4") +shape = SubResource("SphereShape3D_tij10") -[node name="BarMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] -mesh = SubResource("5") +[node name="BarMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] +mesh = SubResource("BoxMesh_3mkeh") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -mesh = SubResource("6") +mesh = SubResource("SphereMesh_37rqd") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_15h3x")] +[node name="GrabPointHandLeft" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_15h3x")] transform = Transform3D(-0.707107, -7.462e-08, -0.707107, 7.462e-08, -1, 3.09086e-08, -0.707107, -3.09086e-08, 0.707107, 0.0760452, -0.0474728, -0.0419973) -hand_pose = SubResource("Resource_oadqy") +visible = true +hand_pose = SubResource("Resource_uvugh") -[node name="GrabPointHandRight" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_v07ov")] +[node name="GrabPointHandRight" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_v07ov")] transform = Transform3D(0.642788, 1.56143e-08, -0.766044, 1.56143e-08, 1, 3.34849e-08, 0.766044, -3.34849e-08, 0.642788, 0.0760452, 0.0525272, -0.0419973) -hand_pose = SubResource("Resource_6ggfb") +visible = true +hand_pose = SubResource("Resource_4ye2w") -[node name="HandleOrigin" type="Node3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableSlider"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.248697, -1.08709e-08) -[node name="InteractableHandle" type="RigidBody3D" parent="SliderOrigin/InteractableSlider/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableSlider/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableSlider/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_vhodf") -[node name="GrabPointRedirectLeft" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_5fki7")] -target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_5fki7")] +target = NodePath("") -[node name="GrabPointRedirectRight" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_5fki7")] -target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_5fki7")] +target = NodePath("") diff --git a/assets/meshes/interactables/slider_zero.tscn b/assets/meshes/interactables/slider_zero.tscn index 3d91bf9d..2ca208e9 100644 --- a/assets/meshes/interactables/slider_zero.tscn +++ b/assets/meshes/interactables/slider_zero.tscn @@ -11,38 +11,38 @@ [ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="8_8wyl7"] [ext_resource type="PackedScene" uid="uid://ca3daqmpo0tua" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_redirect.tscn" id="10_jjlwa"] -[sub_resource type="BoxShape3D" id="1"] +[sub_resource type="BoxShape3D" id="BoxShape3D_5esrr"] size = Vector3(0.2, 0.6, 0.1) -[sub_resource type="BoxMesh" id="2"] +[sub_resource type="BoxMesh" id="BoxMesh_4uwjt"] size = Vector3(0.2, 0.6, 0.1) -[sub_resource type="BoxShape3D" id="3"] +[sub_resource type="BoxShape3D" id="BoxShape3D_1wa2d"] size = Vector3(0.04, 0.04, 0.2) -[sub_resource type="SphereShape3D" id="4"] +[sub_resource type="SphereShape3D" id="SphereShape3D_lw284"] radius = 0.06 -[sub_resource type="BoxMesh" id="5"] +[sub_resource type="BoxMesh" id="BoxMesh_6h8mt"] size = Vector3(0.04, 0.04, 0.2) -[sub_resource type="SphereMesh" id="6"] +[sub_resource type="SphereMesh" id="SphereMesh_wn05x"] radius = 0.06 height = 0.12 radial_segments = 16 rings = 8 -[sub_resource type="Resource" id="Resource_4k01m"] +[sub_resource type="Resource" id="Resource_v2fdj"] script = ExtResource("6_e7vn2") open_pose = ExtResource("5_h4r7f") closed_pose = ExtResource("5_h4r7f") -[sub_resource type="Resource" id="Resource_cnpc5"] +[sub_resource type="Resource" id="Resource_au5ok"] script = ExtResource("6_e7vn2") open_pose = ExtResource("8_8wyl7") closed_pose = ExtResource("8_8wyl7") -[sub_resource type="SphereShape3D" id="7"] +[sub_resource type="SphereShape3D" id="SphereShape3D_yd0c5"] margin = 0.12 radius = 0.06 @@ -51,65 +51,63 @@ radius = 0.06 [node name="Frame" type="StaticBody3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="Frame"] -shape = SubResource("1") +shape = SubResource("BoxShape3D_5esrr") [node name="MeshInstance3D" type="MeshInstance3D" parent="Frame"] -mesh = SubResource("2") +mesh = SubResource("BoxMesh_4uwjt") surface_material_override/0 = ExtResource("1") -[node name="SliderOrigin" type="Node3D" parent="."] -transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, -0.2, 0) - -[node name="InteractableSlider" type="Node3D" parent="SliderOrigin"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0) +[node name="InteractableSlider" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) script = ExtResource("2") -slider_limit_max = 0.4 -slider_position = 0.2 -default_position = 0.2 +slider_limit_min = -0.2 +slider_limit_max = 0.2 default_on_release = true -[node name="SliderBody" type="StaticBody3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) +[node name="SliderBody" type="StaticBody3D" parent="InteractableSlider"] +transform = Transform3D(-4.37114e-08, -1, 4.37114e-08, 0, -4.37114e-08, -1, 1, -4.37114e-08, 3.55271e-15, 0, -0.149944, -6.55426e-09) -[node name="BarCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] -shape = SubResource("3") +[node name="BarCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] +shape = SubResource("BoxShape3D_1wa2d") -[node name="HandleCollision" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleCollision" type="CollisionShape3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -shape = SubResource("4") +shape = SubResource("SphereShape3D_lw284") -[node name="BarMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] -mesh = SubResource("5") +[node name="BarMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] +mesh = SubResource("BoxMesh_6h8mt") surface_material_override/0 = ExtResource("3") -[node name="HandleMesh" type="MeshInstance3D" parent="SliderOrigin/InteractableSlider/SliderBody"] +[node name="HandleMesh" type="MeshInstance3D" parent="InteractableSlider/SliderBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1) -mesh = SubResource("6") +mesh = SubResource("SphereMesh_wn05x") surface_material_override/0 = ExtResource("3") -[node name="GrabPointHandLeft" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_0po6f")] +[node name="GrabPointHandLeft" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("4_0po6f")] transform = Transform3D(-0.707107, -7.462e-08, -0.707107, 7.462e-08, -1, 3.09086e-08, -0.707107, -3.09086e-08, 0.707107, 0.0760452, -0.0474728, -0.0419973) -hand_pose = SubResource("Resource_4k01m") +visible = true +hand_pose = SubResource("Resource_v2fdj") -[node name="GrabPointHandRight" parent="SliderOrigin/InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_1nus5")] +[node name="GrabPointHandRight" parent="InteractableSlider/SliderBody/HandleMesh" instance=ExtResource("7_1nus5")] transform = Transform3D(0.642788, 1.56143e-08, -0.766044, 1.56143e-08, 1, 3.34849e-08, 0.766044, -3.34849e-08, 0.642788, 0.0760452, 0.0525272, -0.0419973) -hand_pose = SubResource("Resource_cnpc5") +visible = true +hand_pose = SubResource("Resource_au5ok") -[node name="HandleOrigin" type="Node3D" parent="SliderOrigin/InteractableSlider"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.2) +[node name="HandleOrigin" type="Node3D" parent="InteractableSlider"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.248697, -1.08709e-08) -[node name="InteractableHandle" type="RigidBody3D" parent="SliderOrigin/InteractableSlider/HandleOrigin"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableSlider/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("4") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle"] -shape = SubResource("7") +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableSlider/HandleOrigin/InteractableHandle"] +shape = SubResource("SphereShape3D_yd0c5") -[node name="GrabPointRedirectLeft" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_jjlwa")] -target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandLeft") +[node name="GrabPointRedirectLeft" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_jjlwa")] +target = NodePath("") -[node name="GrabPointRedirectRight" parent="SliderOrigin/InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_jjlwa")] -target = NodePath("../../../SliderBody/HandleMesh/GrabPointHandRight") +[node name="GrabPointRedirectRight" parent="InteractableSlider/HandleOrigin/InteractableHandle" node_paths=PackedStringArray("target") instance=ExtResource("10_jjlwa")] +target = NodePath("") diff --git a/assets/meshes/interactables/wheel_smooth.tscn b/assets/meshes/interactables/wheel_smooth.tscn index 729a1e24..4cc1a606 100644 --- a/assets/meshes/interactables/wheel_smooth.tscn +++ b/assets/meshes/interactables/wheel_smooth.tscn @@ -7,6 +7,10 @@ [ext_resource type="Resource" uid="uid://bd1dxftyxdgup" path="res://assets/meshes/interactables/pose_grab_wheel_left.tres" id="5_gt8jj"] [ext_resource type="Resource" uid="uid://dsiujx4dllwvd" path="res://assets/meshes/interactables/pose_grab_wheel_right.tres" id="6_ss5gc"] +[sub_resource type="CylinderShape3D" id="CylinderShape3D_3cy60"] +height = 0.04 +radius = 0.22 + [sub_resource type="CylinderShape3D" id="1"] height = 0.02 radius = 0.2 @@ -21,138 +25,133 @@ rings = 0 [sub_resource type="BoxShape3D" id="3"] size = Vector3(0.02, 0.08, 0.1) -[sub_resource type="CylinderShape3D" id="CylinderShape3D_3cy60"] -height = 0.04 -radius = 0.22 - [node name="WheelSmooth" type="Node3D"] -[node name="HingeOrigin" type="Node3D" parent="."] +[node name="InteractableHinge" type="Node3D" parent="."] transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0) - -[node name="InteractableHinge" type="Node3D" parent="HingeOrigin"] script = ExtResource("2") hinge_limit_min = -360.0 hinge_limit_max = 360.0 +hinge_axis = Vector3(0, 0, 1) -[node name="WheelBody" type="StaticBody3D" parent="HingeOrigin/InteractableHinge"] +[node name="HandPoseArea" parent="InteractableHinge" instance=ExtResource("4_2vgo6")] +left_pose = ExtResource("5_gt8jj") +right_pose = ExtResource("6_ss5gc") -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/WheelBody"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandPoseArea"] +transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0) +shape = SubResource("CylinderShape3D_3cy60") + +[node name="WheelBody" type="StaticBody3D" parent="InteractableHinge"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/WheelBody"] transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0) shape = SubResource("1") -[node name="MeshInstance3D" type="MeshInstance3D" parent="HingeOrigin/InteractableHinge/WheelBody"] +[node name="MeshInstance3D" type="MeshInstance3D" parent="InteractableHinge/WheelBody"] transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0) mesh = SubResource("2") surface_material_override/0 = ExtResource("1") -[node name="Handle1" type="Node3D" parent="HingeOrigin/InteractableHinge"] +[node name="HandleOrigin" type="Node3D" parent="InteractableHinge"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle1"] +[node name="InteractableHandle" type="RigidBody3D" parent="InteractableHinge/HandleOrigin"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle1/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin/InteractableHandle"] shape = SubResource("3") -[node name="Handle2" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0.141, -0.141) +[node name="HandleOrigin2" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0.15, 0.15) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle2"] +[node name="InteractableHandle2" type="RigidBody3D" parent="InteractableHinge/HandleOrigin2"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle2/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin2/InteractableHandle2"] shape = SubResource("3") -[node name="Handle3" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, -0.2) +[node name="HandleOrigin3" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0.2) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle3"] +[node name="InteractableHandle3" type="RigidBody3D" parent="InteractableHinge/HandleOrigin3"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle3/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin3/InteractableHandle3"] shape = SubResource("3") -[node name="Handle4" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, -0.707107, 0.707107, 0, -0.707107, -0.707107, 0, -0.141, -0.141) +[node name="HandleOrigin4" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle4"] +[node name="InteractableHandle4" type="RigidBody3D" parent="InteractableHinge/HandleOrigin4"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle4/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin4/InteractableHandle4"] shape = SubResource("3") -[node name="Handle5" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, -1, -8.74228e-08, 0, 8.74228e-08, -1, 0, -0.2, 0) +[node name="HandleOrigin5" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.14, 0.14) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle5"] +[node name="InteractableHandle5" type="RigidBody3D" parent="InteractableHinge/HandleOrigin5"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle5/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin5/InteractableHandle5"] shape = SubResource("3") -[node name="Handle6" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, -0.707107, -0.707107, 0, 0.707107, -0.707107, 0, -0.141, 0.141) +[node name="HandleOrigin6" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 0, -0.14, -0.14) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle6"] +[node name="InteractableHandle6" type="RigidBody3D" parent="InteractableHinge/HandleOrigin6"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle6/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin6/InteractableHandle6"] shape = SubResource("3") -[node name="Handle7" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, 1.19249e-08, -1, 0, 1, 1.19249e-08, 0, 0, 0.2) +[node name="HandleOrigin7" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, -0.2) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle7"] +[node name="InteractableHandle7" type="RigidBody3D" parent="InteractableHinge/HandleOrigin7"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle7/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin7/InteractableHandle7"] shape = SubResource("3") -[node name="Handle8" type="Node3D" parent="HingeOrigin/InteractableHinge"] -transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0.141, 0.141) +[node name="HandleOrigin8" type="Node3D" parent="InteractableHinge"] +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0.14, -0.14) -[node name="InteractableHandle" type="RigidBody3D" parent="HingeOrigin/InteractableHinge/Handle8"] +[node name="InteractableHandle8" type="RigidBody3D" parent="InteractableHinge/HandleOrigin8"] collision_layer = 262144 collision_mask = 0 freeze = true script = ExtResource("3") picked_up_layer = 0 -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/InteractableHinge/Handle8/InteractableHandle"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractableHinge/HandleOrigin8/InteractableHandle8"] shape = SubResource("3") - -[node name="HandPoseArea" parent="HingeOrigin" instance=ExtResource("4_2vgo6")] -left_pose = ExtResource("5_gt8jj") -right_pose = ExtResource("6_ss5gc") - -[node name="CollisionShape3D" type="CollisionShape3D" parent="HingeOrigin/HandPoseArea"] -transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0) -shape = SubResource("CylinderShape3D_3cy60") diff --git a/scenes/interactables_demo/interactables_demo.tscn b/scenes/interactables_demo/interactables_demo.tscn index f5b3c77d..7f75b2bb 100644 --- a/scenes/interactables_demo/interactables_demo.tscn +++ b/scenes/interactables_demo/interactables_demo.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=41 format=3 uid="uid://bqx54elivcbcj"] +[gd_scene load_steps=113 format=3 uid="uid://bqx54elivcbcj"] [ext_resource type="PackedScene" uid="uid://qbmx03iibuuu" path="res://addons/godot-xr-tools/staging/scene_base.tscn" id="1"] [ext_resource type="Script" path="res://scenes/demo_scene_base.gd" id="2_a3nc2"] @@ -9,85 +9,233 @@ [ext_resource type="PackedScene" uid="uid://bjcxf427un2wp" path="res://addons/godot-xr-tools/player/poke/poke.tscn" id="4_nc36h"] [ext_resource type="PackedScene" uid="uid://dukyhft262nrv" path="res://assets/meshes/interactables/slider_snap.tscn" id="5"] [ext_resource type="PackedScene" uid="uid://btf05hjpw6k05" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/right_physics_hand_low.tscn" id="5_x135n"] +[ext_resource type="Animation" uid="uid://dgfeikrugfewi" path="res://addons/godot-xr-tools/hands/animations/left/Cup.res" id="5_y0xgd"] +[ext_resource type="Animation" uid="uid://dlxa6f6hwurka" path="res://addons/godot-xr-tools/hands/animations/left/Default pose.res" id="6_j8b8l"] [ext_resource type="PackedScene" uid="uid://b4ysuy43poobf" path="res://addons/godot-xr-tools/functions/function_pickup.tscn" id="7"] +[ext_resource type="Animation" uid="uid://plad1r85f7ws" path="res://addons/godot-xr-tools/hands/animations/left/Grip.res" id="7_valma"] [ext_resource type="PackedScene" uid="uid://bl2nuu3qhlb5k" path="res://addons/godot-xr-tools/functions/movement_direct.tscn" id="8"] +[ext_resource type="Animation" uid="uid://dqa0h82y3qn1t" path="res://addons/godot-xr-tools/hands/animations/left/Grip 1.res" id="8_5mpen"] [ext_resource type="PackedScene" uid="uid://bwr0eqi231lf0" path="res://assets/meshes/control_pad/control_pad_location_left.tscn" id="8_rx1lv"] [ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="9"] +[ext_resource type="Animation" uid="uid://di384xtde8ydf" path="res://addons/godot-xr-tools/hands/animations/left/Grip 2.res" id="9_xyymq"] [ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="10"] +[ext_resource type="Animation" uid="uid://dd67rufxwj2u" path="res://addons/godot-xr-tools/hands/animations/left/Grip 3.res" id="10_mpq6k"] +[ext_resource type="Animation" uid="uid://db62hs5s4n2b3" path="res://addons/godot-xr-tools/hands/animations/left/Grip 4.res" id="11_843sa"] [ext_resource type="PackedScene" uid="uid://deyk5frilshws" path="res://assets/meshes/control_pad/control_pad_location_right.tscn" id="11_euqkg"] [ext_resource type="PackedScene" uid="uid://d0g2s2yli7iqp" path="res://scenes/interactables_demo/objects/instructions.tscn" id="11_txloh"] [ext_resource type="PackedScene" uid="uid://cpwdvy41fqdua" path="res://assets/meshes/interactables/slider_smooth.tscn" id="12"] +[ext_resource type="Animation" uid="uid://bediglpx0rj7i" path="res://addons/godot-xr-tools/hands/animations/left/Grip 5.res" id="12_r53lq"] [ext_resource type="PackedScene" uid="uid://hv8nnbkuccxi" path="res://assets/meshes/interactables/slider_zero.tscn" id="13"] +[ext_resource type="Animation" uid="uid://nq3xh1olqipq" path="res://addons/godot-xr-tools/hands/animations/left/Grip Shaft.res" id="13_oro2d"] [ext_resource type="PackedScene" uid="uid://ct3p5sgwvkmva" path="res://assets/meshes/control_pad/control_pad.tscn" id="13_qruny"] [ext_resource type="PackedScene" uid="uid://cs6dxfu5owcgo" path="res://assets/meshes/interactables/lever_smooth.tscn" id="14"] +[ext_resource type="Animation" uid="uid://bi1l6lre2w2lp" path="res://addons/godot-xr-tools/hands/animations/left/Hold.res" id="14_l6tml"] [ext_resource type="PackedScene" uid="uid://cll4pk3kuuq1" path="res://assets/meshes/interactables/lever_zero.tscn" id="15"] +[ext_resource type="Animation" uid="uid://c3e6h0rv2uw2d" path="res://addons/godot-xr-tools/hands/animations/left/Horns.res" id="15_ii6ho"] [ext_resource type="PackedScene" uid="uid://dxgv8axd355m7" path="res://assets/meshes/interactables/lever_snap.tscn" id="16"] +[ext_resource type="Animation" uid="uid://dfekure1r6q13" path="res://addons/godot-xr-tools/hands/animations/left/Metal.res" id="16_ussp2"] [ext_resource type="PackedScene" uid="uid://bnckmqfewiysy" path="res://assets/meshes/interactables/joystick_snap.tscn" id="17"] +[ext_resource type="Animation" uid="uid://b0rhk4r0r0t32" path="res://addons/godot-xr-tools/hands/animations/left/Middle.res" id="17_c040v"] [ext_resource type="PackedScene" uid="uid://bvgjfffe0w2uu" path="res://assets/meshes/interactables/joystick_smooth.tscn" id="18"] +[ext_resource type="Animation" uid="uid://f5k0gh4qnmv5" path="res://addons/godot-xr-tools/hands/animations/left/OK.res" id="18_r8lj4"] [ext_resource type="PackedScene" uid="uid://dtrftty6i383g" path="res://assets/meshes/interactables/joystick_zero.tscn" id="19"] +[ext_resource type="Animation" uid="uid://1nlkfvitq7ku" path="res://addons/godot-xr-tools/hands/animations/left/Peace.res" id="19_ygqia"] [ext_resource type="PackedScene" uid="uid://d2td5hwh2oluy" path="res://assets/meshes/interactables/wheel_smooth.tscn" id="20"] +[ext_resource type="Animation" uid="uid://dhjb0e334tfwl" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Flat.res" id="20_l4rrj"] [ext_resource type="PackedScene" uid="uid://dbv1hvxufc1al" path="res://assets/meshes/interactables/push_button.tscn" id="21"] +[ext_resource type="Animation" uid="uid://dkjsnihi81b7p" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Large.res" id="21_gaaak"] +[ext_resource type="Animation" uid="uid://bn0fdhe2jwq3h" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Middle.res" id="22_l5gr0"] +[ext_resource type="Animation" uid="uid://bo1b8w0s4ci81" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Ring.res" id="23_mre68"] +[ext_resource type="Animation" uid="uid://m5x2m8x3tcel" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Tight.res" id="24_6vy14"] +[ext_resource type="Animation" uid="uid://fi23m6i7orhw" path="res://addons/godot-xr-tools/hands/animations/left/Pinch Up.res" id="25_5gwxu"] [ext_resource type="PackedScene" uid="uid://ca6c2h3xsflxf" path="res://assets/maps/holodeck_map.tscn" id="25_f2g0r"] - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bul4v"] +[ext_resource type="Animation" uid="uid://c8qmcuyaltdnw" path="res://addons/godot-xr-tools/hands/animations/left/PingPong.res" id="26_esgtw"] +[ext_resource type="Animation" uid="uid://bqnoubqq7ogwu" path="res://addons/godot-xr-tools/hands/animations/left/Pinky.res" id="27_3f1k6"] +[ext_resource type="Animation" uid="uid://ddbo6ioa282en" path="res://addons/godot-xr-tools/hands/animations/left/Pistol.res" id="28_fq0fp"] +[ext_resource type="Animation" uid="uid://brkptjihht3ae" path="res://addons/godot-xr-tools/hands/animations/left/Ring.res" id="29_uhfrw"] +[ext_resource type="Animation" uid="uid://cnng6xumhw7cx" path="res://addons/godot-xr-tools/hands/animations/left/Rounded.res" id="30_6lie4"] +[ext_resource type="Animation" uid="uid://cevirj0eagdrq" path="res://addons/godot-xr-tools/hands/animations/left/Sign 1.res" id="31_dumk3"] +[ext_resource type="Animation" uid="uid://cc6phxovf1ban" path="res://addons/godot-xr-tools/hands/animations/left/Sign 2.res" id="32_jhv10"] +[ext_resource type="Animation" uid="uid://ohthjp8qbcc4" path="res://addons/godot-xr-tools/hands/animations/left/Sign 3.res" id="33_wiauh"] +[ext_resource type="Animation" uid="uid://dmx42g64577g5" path="res://addons/godot-xr-tools/hands/animations/left/Sign 4.res" id="34_4e3nh"] +[ext_resource type="Animation" uid="uid://dhsoxntrktx0p" path="res://addons/godot-xr-tools/hands/animations/left/Sign 5.res" id="35_1ssai"] +[ext_resource type="Animation" uid="uid://c0u2a3yc2vhg8" path="res://addons/godot-xr-tools/hands/animations/left/Sign_Point.res" id="36_2poop"] +[ext_resource type="Animation" uid="uid://4g211my0hoiw" path="res://addons/godot-xr-tools/hands/animations/left/Straight.res" id="37_f4jxe"] +[ext_resource type="Animation" uid="uid://d06l7hygl4qt3" path="res://addons/godot-xr-tools/hands/animations/left/Surfer.res" id="38_detcg"] +[ext_resource type="Animation" uid="uid://bxei4oebd4hu3" path="res://addons/godot-xr-tools/hands/animations/left/Thumb.res" id="39_ototk"] +[ext_resource type="Animation" uid="uid://do01jton6rk42" path="res://addons/godot-xr-tools/hands/animations/right/Cup.res" id="45_qatrd"] +[ext_resource type="Animation" uid="uid://ky28birj4su6" path="res://addons/godot-xr-tools/hands/animations/right/Default pose.res" id="46_c5pxc"] +[ext_resource type="Animation" uid="uid://ccds2u22gbxn7" path="res://addons/godot-xr-tools/hands/animations/right/Grip.res" id="47_2kg7w"] +[ext_resource type="Animation" uid="uid://daqddcrbpam0c" path="res://addons/godot-xr-tools/hands/animations/right/Grip 1.res" id="48_tm6qb"] +[ext_resource type="Animation" uid="uid://r8hleealhrqt" path="res://addons/godot-xr-tools/hands/animations/right/Grip 2.res" id="49_12026"] +[ext_resource type="Animation" uid="uid://rs7vpclot07o" path="res://addons/godot-xr-tools/hands/animations/right/Grip 3.res" id="50_b72rp"] +[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="51_ohkjv"] +[ext_resource type="Animation" uid="uid://s1vqcxyqcvea" path="res://addons/godot-xr-tools/hands/animations/right/Grip 5.res" id="52_cvmgj"] +[ext_resource type="Animation" uid="uid://c8dghcftg1thx" path="res://addons/godot-xr-tools/hands/animations/right/Grip Shaft.res" id="53_tjcut"] +[ext_resource type="Animation" uid="uid://bv5tuc1kjv0k5" path="res://addons/godot-xr-tools/hands/animations/right/Hold.res" id="54_2xnvw"] +[ext_resource type="Animation" uid="uid://cdjfhqnr4n2mr" path="res://addons/godot-xr-tools/hands/animations/right/Horns.res" id="55_u16ti"] +[ext_resource type="Animation" uid="uid://b1kqsodcr1til" path="res://addons/godot-xr-tools/hands/animations/right/Metal.res" id="56_k40pa"] +[ext_resource type="Animation" uid="uid://cg6fsqb2iuuih" path="res://addons/godot-xr-tools/hands/animations/right/Middle.res" id="57_3tilp"] +[ext_resource type="Animation" uid="uid://c3isimdlxg54a" path="res://addons/godot-xr-tools/hands/animations/right/OK.res" id="58_dwbqm"] +[ext_resource type="Animation" uid="uid://bxmc3vlfih764" path="res://addons/godot-xr-tools/hands/animations/right/Peace.res" id="59_npa88"] +[ext_resource type="Animation" uid="uid://dg4v7rqiaje2h" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Flat.res" id="60_ntjty"] +[ext_resource type="Animation" uid="uid://cuwwpxi44vwpm" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Large.res" id="61_kpwmu"] +[ext_resource type="Animation" uid="uid://c6vghurk7t5yb" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Middle.res" id="62_uwlw5"] +[ext_resource type="Animation" uid="uid://mjotm5uukoo3" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Ring.res" id="63_w0w4y"] +[ext_resource type="Animation" uid="uid://ca21ej1p3g2yt" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Tight.res" id="64_lqb15"] +[ext_resource type="Animation" uid="uid://cseojxi8rrqc" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Up.res" id="65_eokoy"] +[ext_resource type="Animation" uid="uid://c8hn123uon74u" path="res://addons/godot-xr-tools/hands/animations/right/PingPong.res" id="66_f6agg"] +[ext_resource type="Animation" uid="uid://b6ra3rqia1gvb" path="res://addons/godot-xr-tools/hands/animations/right/Pinky.res" id="67_5j1up"] +[ext_resource type="Animation" uid="uid://csp3fdknowmi5" path="res://addons/godot-xr-tools/hands/animations/right/Pistol.res" id="68_iwxg8"] +[ext_resource type="Animation" uid="uid://2ttepgvf634h" path="res://addons/godot-xr-tools/hands/animations/right/Ring.res" id="69_8j76b"] +[ext_resource type="Animation" uid="uid://wcwa3p1qrhwr" path="res://addons/godot-xr-tools/hands/animations/right/Rounded.res" id="70_a0vix"] +[ext_resource type="Animation" uid="uid://bcwx6a6mhsoj2" path="res://addons/godot-xr-tools/hands/animations/right/Sign 1.res" id="71_m8p1k"] +[ext_resource type="Animation" uid="uid://btnsp36fjkldf" path="res://addons/godot-xr-tools/hands/animations/right/Sign 2.res" id="72_c8cv7"] +[ext_resource type="Animation" uid="uid://c35i6glt1ov2m" path="res://addons/godot-xr-tools/hands/animations/right/Sign 3.res" id="73_a5d2f"] +[ext_resource type="Animation" uid="uid://b8mmk2ufmlyf" path="res://addons/godot-xr-tools/hands/animations/right/Sign 4.res" id="74_g42y6"] +[ext_resource type="Animation" uid="uid://ddgl3lsnlfiny" path="res://addons/godot-xr-tools/hands/animations/right/Sign 5.res" id="75_8m6fc"] +[ext_resource type="Animation" uid="uid://ccy3e7a0hvxyl" path="res://addons/godot-xr-tools/hands/animations/right/Sign_Point.res" id="76_aghx8"] +[ext_resource type="Animation" uid="uid://d3h36bkauutoq" path="res://addons/godot-xr-tools/hands/animations/right/Straight.res" id="77_l8fxa"] +[ext_resource type="Animation" uid="uid://bq7cjxdn28jcv" path="res://addons/godot-xr-tools/hands/animations/right/Surfer.res" id="78_yj3nu"] +[ext_resource type="Animation" uid="uid://d2ukhr3n2r1u8" path="res://addons/godot-xr-tools/hands/animations/right/Thumb.res" id="79_4wkac"] + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_kw48d"] +_data = { +"Cup": ExtResource("5_y0xgd"), +"Default pose": ExtResource("6_j8b8l"), +"Grip": ExtResource("7_valma"), +"Grip 1": ExtResource("8_5mpen"), +"Grip 2": ExtResource("9_xyymq"), +"Grip 3": ExtResource("10_mpq6k"), +"Grip 4": ExtResource("11_843sa"), +"Grip 5": ExtResource("12_r53lq"), +"Grip Shaft": ExtResource("13_oro2d"), +"Hold": ExtResource("14_l6tml"), +"Horns": ExtResource("15_ii6ho"), +"Metal": ExtResource("16_ussp2"), +"Middle": ExtResource("17_c040v"), +"OK": ExtResource("18_r8lj4"), +"Peace": ExtResource("19_ygqia"), +"Pinch Flat": ExtResource("20_l4rrj"), +"Pinch Large": ExtResource("21_gaaak"), +"Pinch Middle": ExtResource("22_l5gr0"), +"Pinch Ring": ExtResource("23_mre68"), +"Pinch Tight": ExtResource("24_6vy14"), +"Pinch Up": ExtResource("25_5gwxu"), +"PingPong": ExtResource("26_esgtw"), +"Pinky": ExtResource("27_3f1k6"), +"Pistol": ExtResource("28_fq0fp"), +"Ring": ExtResource("29_uhfrw"), +"Rounded": ExtResource("30_6lie4"), +"Sign 1": ExtResource("31_dumk3"), +"Sign 2": ExtResource("32_jhv10"), +"Sign 3": ExtResource("33_wiauh"), +"Sign 4": ExtResource("34_4e3nh"), +"Sign 5": ExtResource("35_1ssai"), +"Sign_Point": ExtResource("36_2poop"), +"Straight": ExtResource("37_f4jxe"), +"Surfer": ExtResource("38_detcg"), +"Thumb": ExtResource("39_ototk") +} + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kqx57"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8kt1f"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_73h17"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_2dgfp"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_qxxcx"] 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_e5jrp"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_odp7s"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_qbsbn"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_o502h"] 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_otnhb"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_yjam3"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_bul4v") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_kqx57") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_8kt1f") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_73h17") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_2dgfp") +nodes/Grip/node = SubResource("AnimationNodeBlend2_qxxcx") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_e5jrp") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_odp7s") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_qbsbn") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_o502h") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_cnn52"] +[sub_resource type="AnimationLibrary" id="AnimationLibrary_reqae"] +_data = { +"Cup": ExtResource("45_qatrd"), +"Default pose": ExtResource("46_c5pxc"), +"Grip": ExtResource("47_2kg7w"), +"Grip 1": ExtResource("48_tm6qb"), +"Grip 2": ExtResource("49_12026"), +"Grip 3": ExtResource("50_b72rp"), +"Grip 4": ExtResource("51_ohkjv"), +"Grip 5": ExtResource("52_cvmgj"), +"Grip Shaft": ExtResource("53_tjcut"), +"Hold": ExtResource("54_2xnvw"), +"Horns": ExtResource("55_u16ti"), +"Metal": ExtResource("56_k40pa"), +"Middle": ExtResource("57_3tilp"), +"OK": ExtResource("58_dwbqm"), +"Peace": ExtResource("59_npa88"), +"Pinch Flat": ExtResource("60_ntjty"), +"Pinch Large": ExtResource("61_kpwmu"), +"Pinch Middle": ExtResource("62_uwlw5"), +"Pinch Ring": ExtResource("63_w0w4y"), +"Pinch Tight": ExtResource("64_lqb15"), +"Pinch Up": ExtResource("65_eokoy"), +"PingPong": ExtResource("66_f6agg"), +"Pinky": ExtResource("67_5j1up"), +"Pistol": ExtResource("68_iwxg8"), +"Ring": ExtResource("69_8j76b"), +"Rounded": ExtResource("70_a0vix"), +"Sign 1": ExtResource("71_m8p1k"), +"Sign 2": ExtResource("72_c8cv7"), +"Sign 3": ExtResource("73_a5d2f"), +"Sign 4": ExtResource("74_g42y6"), +"Sign 5": ExtResource("75_8m6fc"), +"Sign_Point": ExtResource("76_aghx8"), +"Straight": ExtResource("77_l8fxa"), +"Surfer": ExtResource("78_yj3nu"), +"Thumb": ExtResource("79_4wkac") +} + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_uh3bg"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1mlr5"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_w0tjx"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_wgpq4"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cdw8y"] 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_i5kg6"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_sv6rl"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_6131t"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_4kda2"] 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_uouko"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_ulbks"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_cnn52") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_uh3bg") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_1mlr5") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_w0tjx") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_wgpq4") +nodes/Grip/node = SubResource("AnimationNodeBlend2_cdw8y") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_i5kg6") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_sv6rl") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_6131t") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_4kda2") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -188,7 +336,11 @@ mask = 4194304 push_bodies = false [node name="AnimationTree" parent="XROrigin3D/LeftHand/LeftPhysicsHand" index="1"] -tree_root = SubResource("AnimationNodeBlendTree_otnhb") +root_node = NodePath("../Hand_Nails_low_L") +libraries = { +"": SubResource("AnimationLibrary_kw48d") +} +tree_root = SubResource("AnimationNodeBlendTree_yjam3") [node name="FunctionPoseDetector" parent="XROrigin3D/LeftHand" index="1" instance=ExtResource("3_s2g5l")] @@ -294,7 +446,11 @@ mask = 4194304 push_bodies = false [node name="AnimationTree" parent="XROrigin3D/RightHand/RightPhysicsHand" index="1"] -tree_root = SubResource("AnimationNodeBlendTree_uouko") +root_node = NodePath("../Hand_Nails_low_R") +libraries = { +"": SubResource("AnimationLibrary_reqae") +} +tree_root = SubResource("AnimationNodeBlendTree_ulbks") [node name="FunctionPoseDetector" parent="XROrigin3D/RightHand" index="1" instance=ExtResource("3_s2g5l")] @@ -312,16 +468,19 @@ ranged_enable = false [node name="ControlPad" parent="XROrigin3D" index="4" instance=ExtResource("13_qruny")] [node name="HolodeckMap" parent="." index="1" instance=ExtResource("25_f2g0r")] +metadata/_edit_lock_ = true [node name="MainMenuTeleport" parent="." index="2" instance=ExtResource("3")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4) -scene_base = NodePath("..") title = ExtResource("4") +metadata/_edit_lock_ = true [node name="Instructions" parent="." index="3" instance=ExtResource("11_txloh")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, -4) +metadata/_edit_lock_ = true [node name="Interactables" type="Node3D" parent="." index="4"] +metadata/_edit_lock_ = true [node name="SliderSmooth" parent="Interactables" index="0" instance=ExtResource("12")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 1, -2) @@ -342,16 +501,16 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.9, 1, -2) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2, 1, -2) [node name="JoystickSmooth" parent="Interactables" index="6" instance=ExtResource("18")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, -2) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.899534, 1.5, -2) [node name="JoystickSnap" parent="Interactables" index="7" instance=ExtResource("17")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 1.5, -2) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.19953, 1.5, -2) [node name="JoystickZero" parent="Interactables" index="8" instance=ExtResource("19")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3, 1.5, -2) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.599534, 1.5, -2) [node name="WheelSmooth" parent="Interactables" index="9" instance=ExtResource("20")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -2) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.46064, -2) [node name="PushButton1" parent="Interactables" index="10" instance=ExtResource("21")] transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, -1.6, 1.2, -2) From 3423e2c5afea2db744d0a952bb5f990cd3124cc8 Mon Sep 17 00:00:00 2001 From: squid Date: Wed, 27 Nov 2024 18:33:35 -0700 Subject: [PATCH 6/6] Cleanup hinge code - Calculate derived variables instead of setting - Remove unused variable - Fix the 'get_final_axis()' to just be the local 'hinge_axis' direction set by user - Remove 'get_final_axis()' - Remove extra check for change before setting 'hinge_position' --- .../interactables/interactable_hinge.gd | 142 +++++++----------- assets/meshes/interactables/wheel_smooth.tscn | 2 - 2 files changed, 54 insertions(+), 90 deletions(-) diff --git a/addons/godot-xr-tools/interactables/interactable_hinge.gd b/addons/godot-xr-tools/interactables/interactable_hinge.gd index 0120f15f..8c5439f3 100644 --- a/addons/godot-xr-tools/interactables/interactable_hinge.gd +++ b/addons/godot-xr-tools/interactables/interactable_hinge.gd @@ -20,34 +20,57 @@ signal hinge_moved(angle) ## Hinge minimum limit -@export var hinge_limit_min : float = -45.0: set = _set_hinge_limit_min +@export var hinge_limit_min : float = -45.0 ## Hinge maximum limit -@export var hinge_limit_max : float = 45.0: set = _set_hinge_limit_max +@export var hinge_limit_max : float = 45.0 ## Hinge step size (zero for no steps) -@export var hinge_steps : float = 0.0: set = _set_hinge_steps +@export var hinge_steps : float = 0.0 + ## Hinge position -@export var hinge_position : float = 0.0: set = _set_hinge_position +@export var hinge_position : float = 0.0: + set(v): + # Apply constraints + var radians = _apply_hinge_constraints(deg_to_rad(v)) + + # No change + if is_equal_approx(radians, _hinge_position_rad): + return + + # Set, Emit + _is_driven_change = true + transform = _private_transform.rotated_local(hinge_axis, radians) + hinge_position = rad_to_deg(radians) + hinge_moved.emit(hinge_position) + ## Default position -@export var default_position : float = 0.0: set = _set_default_position +@export var default_position : float = 0.0 + +## Allow hinge to wrap between min and max limits +@export var hinge_wrapping : bool = false ## If true, the hinge moves to the default position when releases @export var default_on_release : bool = false -## Set to rotate about this local axis +## Define a local axis to rotate about @export var hinge_axis := Vector3.RIGHT: set(v): hinge_axis = v.normalized() # Hinge values in radians -@onready var _hinge_limit_min_rad : float = deg_to_rad(hinge_limit_min) -@onready var _hinge_limit_max_rad : float = deg_to_rad(hinge_limit_max) -@onready var _hinge_steps_rad : float = deg_to_rad(hinge_steps) -@onready var _hinge_position_rad : float = deg_to_rad(hinge_position) -@onready var _default_position_rad : float = deg_to_rad(default_position) +@onready var _hinge_limit_min_rad : float: + get: return deg_to_rad(hinge_limit_min) +@onready var _hinge_limit_max_rad : float: + get: return deg_to_rad(hinge_limit_max) +@onready var _hinge_steps_rad : float: + get: return deg_to_rad(hinge_steps) +@onready var _hinge_position_rad : float: + get: return deg_to_rad(hinge_position) +@onready var _default_position_rad : float: + get: return deg_to_rad(default_position) # Add support for is_xr_class on XRTools classes @@ -69,17 +92,14 @@ func _ready(): func _process(_delta: float) -> void: # Get the total handle angular offsets var offset_sum := 0.0 - for item in grabbed_handles: - var handle := item as XRToolsInteractableHandle - # global handle + handle_origin position - var axis := get_final_axis() - var to_handle : Vector3 = handle.global_transform.origin * global_transform - var to_handle_origin : Vector3 = handle.handle_origin.global_transform.origin * global_transform - var a_old = to_handle_origin.signed_angle_to(to_handle, axis) - - # project 'to_handle' and 'to_handle_origin' on 'axis' - # then measure the angle - offset_sum += atan2(to_handle_origin.cross(to_handle).dot(axis), to_handle.dot(to_handle_origin)) + for handle : XRToolsInteractableHandle in grabbed_handles: + # Move to local space + var to_handle := handle.global_transform.origin * global_transform + var to_origin := handle.handle_origin.global_transform.origin * global_transform + + # Find angle + # Project 'to_handle' and 'to_handle_origin' on 'hinge_axis' + offset_sum += atan2(to_origin.cross(to_handle).dot(hinge_axis), to_handle.dot(to_origin)) # Average the angular offsets var offset := offset_sum / grabbed_handles.size() @@ -88,79 +108,25 @@ func _process(_delta: float) -> void: move_hinge(_hinge_position_rad + offset) -## Return a unit vector of the final rotation axis -func get_final_axis() -> Vector3: - return (hinge_axis * _private_transform.basis.inverse()).normalized() - - # Move the hinge to the specified position -func move_hinge(position: float) -> void: +func move_hinge(radians: float) -> void: # Do the hinge move - position = _do_move_hinge(position) - if position == _hinge_position_rad: - return + hinge_position = rad_to_deg(radians) - # Update the current positon - _hinge_position_rad = position - hinge_position = rad_to_deg(position) - # Emit the moved signal - hinge_moved.emit(hinge_position) +# Returns 'radians' with step-quantization and min/max limits applied +func _apply_hinge_constraints(radians: float) -> float: + # Apply hinge step-quantization + if !is_zero_approx(_hinge_steps_rad): + radians = roundf(radians / _hinge_steps_rad) * _hinge_steps_rad + + # Apply hinge limits + if hinge_wrapping: + return wrapf(radians, _hinge_limit_min_rad, _hinge_limit_max_rad) + return clampf(radians, _hinge_limit_min_rad, _hinge_limit_max_rad) # Handle release of hinge func _on_hinge_released(_interactable: XRToolsInteractableHinge): if default_on_release: move_hinge(_default_position_rad) - - -# Called when hinge_limit_min is set externally -func _set_hinge_limit_min(value: float) -> void: - hinge_limit_min = value - _hinge_limit_min_rad = deg_to_rad(value) - - -# Called when hinge_limit_max is set externally -func _set_hinge_limit_max(value: float) -> void: - hinge_limit_max = value - _hinge_limit_max_rad = deg_to_rad(value) - - -# Called when hinge_steps is set externally -func _set_hinge_steps(value: float) -> void: - hinge_steps = value - _hinge_steps_rad = deg_to_rad(value) - - -# Called when hinge_position is set externally -func _set_hinge_position(value: float) -> void: - - _is_driven_change = true - var rads := deg_to_rad(value) - rads = _do_move_hinge(rads) - hinge_position = rad_to_deg(rads) - _hinge_position_rad = rads - - -# Called when default_position is set externally -func _set_default_position(value: float) -> void: - default_position = value - _default_position_rad = deg_to_rad(value) - - -# Do the hinge move -func _do_move_hinge(_angle_radians: float) -> float: - # Apply hinge step-quantization - if _hinge_steps_rad: - _angle_radians = round(_angle_radians / _hinge_steps_rad) * _hinge_steps_rad - - # Apply hinge limits - _angle_radians = clamp(_angle_radians, _hinge_limit_min_rad, _hinge_limit_max_rad) - - # Move if necessary - if _angle_radians != _hinge_position_rad: - _is_driven_change = true - transform = _private_transform.rotated_local(get_final_axis(), _angle_radians) - - # Return the updated _angle_radians - return _angle_radians diff --git a/assets/meshes/interactables/wheel_smooth.tscn b/assets/meshes/interactables/wheel_smooth.tscn index 4cc1a606..7c811b2b 100644 --- a/assets/meshes/interactables/wheel_smooth.tscn +++ b/assets/meshes/interactables/wheel_smooth.tscn @@ -28,11 +28,9 @@ size = Vector3(0.02, 0.08, 0.1) [node name="WheelSmooth" type="Node3D"] [node name="InteractableHinge" type="Node3D" parent="."] -transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0) script = ExtResource("2") hinge_limit_min = -360.0 hinge_limit_max = 360.0 -hinge_axis = Vector3(0, 0, 1) [node name="HandPoseArea" parent="InteractableHinge" instance=ExtResource("4_2vgo6")] left_pose = ExtResource("5_gt8jj")