From b539680f92b7852bbfa82a2e33d89476942e8ef4 Mon Sep 17 00:00:00 2001 From: Malcolm Nixon Date: Fri, 23 Sep 2022 00:48:35 -0400 Subject: [PATCH] Renamed files and classes to match new godot-xr-tools standard. Minor gdlint cleanups. --- .../assets/{Hand.gd => hand.gd} | 10 +- ...andBlendTree.tres => hand_blend_tree.tres} | 2 +- ...andPhysicsBone.gd => hand_physics_bone.gd} | 2 +- .../{LeftHand.blend => left_hand.blend} | Bin .../assets/{LeftHand.glb => left_hand.glb} | Bin ...htHand.glb.import => left_hand.glb.import} | 6 +- .../assets/{LeftHand.tscn => left_hand.tscn} | 6 +- ...hysicsHand.tscn => left_physics_hand.tscn} | 6 +- .../{PhysicsHand.gd => physics_hand.gd} | 0 .../assets/{PlayerBody.gd => player_body.gd} | 66 ++-- .../{PlayerBody.tscn => player_body.tscn} | 2 +- .../assets/{RightHand.glb => right_hand.glb} | Bin ...tHand.glb.import => right_hand.glb.import} | 6 +- .../{RightHand.tscn => right_hand.tscn} | 6 +- ...ysicsHand.tscn => right_physics_hand.tscn} | 6 +- .../icons/XRToolsMovementProvider.svg.import | 35 -- .../icons/{XRToolsBody.svg => body.svg} | 0 ...XRToolsHand.svg.import => body.svg.import} | 6 +- .../{XRToolsFunction.svg => function.svg} | 0 ...olsNode.svg.import => function.svg.import} | 6 +- .../icons/{XRToolsHand.svg => hand.svg} | 0 ...XRToolsBody.svg.import => hand.svg.import} | 6 +- ...mentProvider.svg => movement_provider.svg} | 0 .../editor/icons/movement_provider.svg.import | 35 ++ .../icons/{XRToolsNode.svg => node.svg} | 0 ...olsFunction.svg.import => node.svg.import} | 6 +- addons/godot-xr-tools/effects/vignette.gd | 10 +- .../examples/Function_Fall_damage.tscn | 6 - ...Function_Fall_damage.gd => fall_damage.gd} | 8 +- .../godot-xr-tools/examples/fall_damage.tscn | 6 + .../functions/Function_Climb_movement.tscn | 8 - .../functions/Function_Crouch_movement.tscn | 6 - .../functions/Function_Direct_movement.tscn | 11 - .../functions/Function_Flight_movement.tscn | 6 - .../functions/Function_Glide_movement.tscn | 8 - .../Function_JumpDetect_movement.tscn | 7 - .../functions/Function_Jump_movement.tscn | 7 - .../functions/Function_Pickup.tscn | 6 - .../functions/Function_Turn_movement.tscn | 6 - .../functions/Function_Wind_movement.tscn | 6 - ...{Function_Pickup.gd => function_pickup.gd} | 6 +- .../functions/function_pickup.tscn | 6 + ...unction_pointer.gd => function_pointer.gd} | 22 +- ...ion_pointer.tscn => function_pointer.tscn} | 5 +- ...ction_Teleport.gd => function_teleport.gd} | 87 ++--- ...n_Teleport.tscn => function_teleport.tscn} | 21 +- ...on_Climb_movement.gd => movement_climb.gd} | 33 +- .../functions/movement_climb.tscn | 6 + ..._Crouch_movement.gd => movement_crouch.gd} | 11 +- .../functions/movement_crouch.tscn | 6 + ..._Direct_movement.gd => movement_direct.gd} | 13 +- .../functions/movement_direct.tscn | 10 + ..._Flight_movement.gd => movement_flight.gd} | 8 +- .../functions/movement_flight.tscn | 6 + ...on_Glide_movement.gd => movement_glide.gd} | 13 +- .../functions/movement_glide.tscn | 6 + ...rapple_movement.gd => movement_grapple.gd} | 21 +- ...le_movement.tscn => movement_grapple.tscn} | 4 +- ...tion_Jump_movement.gd => movement_jump.gd} | 17 +- .../functions/movement_jump.tscn | 7 + ...ct_movement.gd => movement_jump_detect.gd} | 50 +-- .../functions/movement_jump_detect.tscn | 7 + ...vementProvider.gd => movement_provider.gd} | 16 +- ...tion_Turn_movement.gd => movement_turn.gd} | 10 +- .../functions/movement_turn.tscn | 6 + ...tion_Wind_movement.gd => movement_wind.gd} | 20 +- .../functions/movement_wind.tscn | 6 + ..._button.gd => interactable_area_button.gd} | 6 +- .../interactable_area_button.tscn | 6 + ...table_handle.gd => interactable_handle.gd} | 8 +- ...e_handle.tscn => interactable_handle.tscn} | 2 +- ...riven.gd => interactable_handle_driven.gd} | 10 +- ...actable_hinge.gd => interactable_hinge.gd} | 12 +- .../interactables/interactable_hinge.tscn | 6 + ...e_joystick.gd => interactable_joystick.gd} | 21 +- .../interactables/interactable_joystick.tscn | 6 + ...table_slider.gd => interactable_slider.gd} | 14 +- .../interactables/interactable_slider.tscn | 6 + .../xrt_interactable_area_button.tscn | 6 - .../interactables/xrt_interactable_hinge.tscn | 6 - .../xrt_interactable_joystick.tscn | 6 - .../xrt_interactable_slider.tscn | 6 - .../godot-xr-tools/materials/highlight.tres | 2 +- .../misc/{ARVR_Helpers.gd => arvr_helpers.gd} | 6 +- addons/godot-xr-tools/misc/hold_button.gd | 109 ++++--- .../misc/hold_button_visualshader.tres | 24 +- .../misc/{Move_To.gd => move_to.gd} | 12 +- ...ocity_Averager.gd => velocity_averager.gd} | 20 +- ..._Linear.gd => velocity_averager_linear.gd} | 12 +- ...der_Cache.gd => vr_common_shader_cache.gd} | 2 +- ...Cache.tscn => vr_common_shader_cache.tscn} | 4 +- .../objects/Object_climbable.gd | 51 --- .../objects/Object_climbable.tscn | 8 - addons/godot-xr-tools/objects/Snap_Zone.tscn | 14 - .../objects/Virtual_Keyboard.tscn | 11 - addons/godot-xr-tools/objects/climbable.gd | 52 +++ addons/godot-xr-tools/objects/climbable.tscn | 8 + .../objects/highlight/highlight_material.gd | 4 +- .../objects/highlight/highlight_ring.gd | 4 +- .../objects/highlight/highlight_ring.tscn | 2 +- .../objects/highlight/highlight_visible.gd | 4 +- ...eractable_area.gd => interactable_area.gd} | 2 +- ...eractable_body.gd => interactable_body.gd} | 2 +- .../{VirtualKey.gd => virtual_key.gd} | 6 +- .../{VirtualKey.tscn => virtual_key.tscn} | 2 +- ...lKeyboard_2D.gd => virtual_keyboard_2d.gd} | 18 +- ...board_2D.tscn => virtual_keyboard_2d.tscn} | 6 +- .../{Object_pickable.gd => pickable.gd} | 2 +- .../{Object_pickable.tscn => pickable.tscn} | 5 +- .../objects/{Snap_Zone.gd => snap_zone.gd} | 20 +- addons/godot-xr-tools/objects/snap_zone.tscn | 14 + ...wport_2D_in_3D.gd => viewport_2d_in_3d.gd} | 0 ...t_2D_in_3D.tscn => viewport_2d_in_3d.tscn} | 14 +- ...n_3D_body.gd => viewport_2d_in_3d_body.gd} | 16 +- .../objects/virtual_keyboard.tscn | 11 + .../objects/{Wind_area.gd => wind_area.gd} | 2 +- .../{Wind_area.tscn => wind_area.tscn} | 2 +- .../godot-xr-tools/overrides/GroundPhysics.gd | 37 --- .../overrides/ground_physics.gd | 36 ++ ...GroundPhysics.tscn => ground_physics.tscn} | 2 +- ...Settings.gd => ground_physics_settings.gd} | 66 ++-- .../meshes/interactables/joystick_smooth.tscn | 4 +- .../meshes/interactables/joystick_snap.tscn | 4 +- .../meshes/interactables/joystick_zero.tscn | 4 +- assets/meshes/interactables/lever_smooth.tscn | 4 +- assets/meshes/interactables/lever_snap.tscn | 4 +- assets/meshes/interactables/lever_zero.tscn | 4 +- assets/meshes/interactables/push_button.tscn | 2 +- .../meshes/interactables/slider_smooth.tscn | 4 +- assets/meshes/interactables/slider_snap.tscn | 4 +- assets/meshes/interactables/slider_zero.tscn | 4 +- assets/meshes/interactables/wheel_smooth.tscn | 4 +- loading_screen/loading_screen_shader.tres | 13 +- project.godot | 308 +++++++++--------- .../basic_movement_demo.tscn | 27 +- .../climbing_gliding_demo.tscn | 53 +-- scenes/grappling_demo/grappling_demo.tscn | 46 +-- .../interactables_demo.tscn | 22 +- scenes/main_menu/main_menu_level.tscn | 16 +- scenes/pickable_demo/grab_ball.tscn | 2 +- scenes/pickable_demo/grab_cube.tscn | 4 +- scenes/pickable_demo/pickable_demo.tscn | 22 +- scenes/pickable_demo/snap_toy_red.tscn | 4 +- scenes/pickable_demo/snap_toy_yellow.tscn | 4 +- scenes/pickable_demo/snap_tray.tscn | 12 +- scenes/pointer_demo/pointer_demo.tscn | 31 +- scenes/teleport_demo/teleport_demo.tscn | 12 +- staging.tscn | 2 +- 148 files changed, 1045 insertions(+), 1044 deletions(-) rename addons/godot-xr-tools/assets/{Hand.gd => hand.gd} (96%) rename addons/godot-xr-tools/assets/{HandBlendTree.tres => hand_blend_tree.tres} (91%) rename addons/godot-xr-tools/assets/{HandPhysicsBone.gd => hand_physics_bone.gd} (99%) rename addons/godot-xr-tools/assets/{LeftHand.blend => left_hand.blend} (100%) rename addons/godot-xr-tools/assets/{LeftHand.glb => left_hand.glb} (100%) rename addons/godot-xr-tools/assets/{RightHand.glb.import => left_hand.glb.import} (99%) rename addons/godot-xr-tools/assets/{LeftHand.tscn => left_hand.tscn} (64%) rename addons/godot-xr-tools/assets/{LeftPhysicsHand.tscn => left_physics_hand.tscn} (96%) rename addons/godot-xr-tools/assets/{PhysicsHand.gd => physics_hand.gd} (100%) rename addons/godot-xr-tools/assets/{PlayerBody.gd => player_body.gd} (88%) rename addons/godot-xr-tools/assets/{PlayerBody.tscn => player_body.tscn} (84%) rename addons/godot-xr-tools/assets/{RightHand.glb => right_hand.glb} (100%) rename addons/godot-xr-tools/assets/{LeftHand.glb.import => right_hand.glb.import} (99%) rename addons/godot-xr-tools/assets/{RightHand.tscn => right_hand.tscn} (64%) rename addons/godot-xr-tools/assets/{RightPhysicsHand.tscn => right_physics_hand.tscn} (96%) delete mode 100644 addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg.import rename addons/godot-xr-tools/editor/icons/{XRToolsBody.svg => body.svg} (100%) rename addons/godot-xr-tools/editor/icons/{XRToolsHand.svg.import => body.svg.import} (68%) rename addons/godot-xr-tools/editor/icons/{XRToolsFunction.svg => function.svg} (100%) rename addons/godot-xr-tools/editor/icons/{XRToolsNode.svg.import => function.svg.import} (68%) rename addons/godot-xr-tools/editor/icons/{XRToolsHand.svg => hand.svg} (100%) rename addons/godot-xr-tools/editor/icons/{XRToolsBody.svg.import => hand.svg.import} (68%) rename addons/godot-xr-tools/editor/icons/{XRToolsMovementProvider.svg => movement_provider.svg} (100%) create mode 100644 addons/godot-xr-tools/editor/icons/movement_provider.svg.import rename addons/godot-xr-tools/editor/icons/{XRToolsNode.svg => node.svg} (100%) rename addons/godot-xr-tools/editor/icons/{XRToolsFunction.svg.import => node.svg.import} (67%) delete mode 100644 addons/godot-xr-tools/examples/Function_Fall_damage.tscn rename addons/godot-xr-tools/examples/{Function_Fall_damage.gd => fall_damage.gd} (93%) create mode 100644 addons/godot-xr-tools/examples/fall_damage.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Climb_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Crouch_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Direct_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Flight_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Glide_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_JumpDetect_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Jump_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Pickup.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Turn_movement.tscn delete mode 100644 addons/godot-xr-tools/functions/Function_Wind_movement.tscn rename addons/godot-xr-tools/functions/{Function_Pickup.gd => function_pickup.gd} (98%) create mode 100644 addons/godot-xr-tools/functions/function_pickup.tscn rename addons/godot-xr-tools/functions/{Function_pointer.gd => function_pointer.gd} (99%) rename addons/godot-xr-tools/functions/{Function_pointer.tscn => function_pointer.tscn} (84%) rename addons/godot-xr-tools/functions/{Function_Teleport.gd => function_teleport.gd} (98%) rename addons/godot-xr-tools/functions/{Function_Teleport.tscn => function_teleport.tscn} (81%) rename addons/godot-xr-tools/functions/{Function_Climb_movement.gd => movement_climb.gd} (80%) create mode 100644 addons/godot-xr-tools/functions/movement_climb.tscn rename addons/godot-xr-tools/functions/{Function_Crouch_movement.gd => movement_crouch.gd} (87%) create mode 100644 addons/godot-xr-tools/functions/movement_crouch.tscn rename addons/godot-xr-tools/functions/{Function_Direct_movement.gd => movement_direct.gd} (77%) create mode 100644 addons/godot-xr-tools/functions/movement_direct.tscn rename addons/godot-xr-tools/functions/{Function_Flight_movement.gd => movement_flight.gd} (96%) create mode 100644 addons/godot-xr-tools/functions/movement_flight.tscn rename addons/godot-xr-tools/functions/{Function_Glide_movement.gd => movement_glide.gd} (91%) create mode 100644 addons/godot-xr-tools/functions/movement_glide.tscn rename addons/godot-xr-tools/functions/{Function_Grapple_movement.gd => movement_grapple.gd} (93%) rename addons/godot-xr-tools/functions/{Function_Grapple_movement.tscn => movement_grapple.tscn} (81%) rename addons/godot-xr-tools/functions/{Function_Jump_movement.gd => movement_jump.gd} (71%) create mode 100644 addons/godot-xr-tools/functions/movement_jump.tscn rename addons/godot-xr-tools/functions/{Function_JumpDetect_movement.gd => movement_jump_detect.gd} (93%) create mode 100644 addons/godot-xr-tools/functions/movement_jump_detect.tscn rename addons/godot-xr-tools/functions/{MovementProvider.gd => movement_provider.gd} (80%) rename addons/godot-xr-tools/functions/{Function_Turn_movement.gd => movement_turn.gd} (87%) create mode 100644 addons/godot-xr-tools/functions/movement_turn.tscn rename addons/godot-xr-tools/functions/{Function_Wind_movement.gd => movement_wind.gd} (89%) create mode 100644 addons/godot-xr-tools/functions/movement_wind.tscn rename addons/godot-xr-tools/interactables/{xrt_interactable_area_button.gd => interactable_area_button.gd} (98%) create mode 100644 addons/godot-xr-tools/interactables/interactable_area_button.tscn rename addons/godot-xr-tools/interactables/{xrt_interactable_handle.gd => interactable_handle.gd} (97%) rename addons/godot-xr-tools/interactables/{xrt_interactable_handle.tscn => interactable_handle.tscn} (66%) rename addons/godot-xr-tools/interactables/{xrt_interactable_handle_driven.gd => interactable_handle_driven.gd} (88%) rename addons/godot-xr-tools/interactables/{xrt_interactable_hinge.gd => interactable_hinge.gd} (96%) create mode 100644 addons/godot-xr-tools/interactables/interactable_hinge.tscn rename addons/godot-xr-tools/interactables/{xrt_interactable_joystick.gd => interactable_joystick.gd} (97%) create mode 100644 addons/godot-xr-tools/interactables/interactable_joystick.tscn rename addons/godot-xr-tools/interactables/{xrt_interactable_slider.gd => interactable_slider.gd} (94%) create mode 100644 addons/godot-xr-tools/interactables/interactable_slider.tscn delete mode 100644 addons/godot-xr-tools/interactables/xrt_interactable_area_button.tscn delete mode 100644 addons/godot-xr-tools/interactables/xrt_interactable_hinge.tscn delete mode 100644 addons/godot-xr-tools/interactables/xrt_interactable_joystick.tscn delete mode 100644 addons/godot-xr-tools/interactables/xrt_interactable_slider.tscn rename addons/godot-xr-tools/misc/{ARVR_Helpers.gd => arvr_helpers.gd} (99%) rename addons/godot-xr-tools/misc/{Move_To.gd => move_to.gd} (98%) rename addons/godot-xr-tools/misc/{Velocity_Averager.gd => velocity_averager.gd} (95%) rename addons/godot-xr-tools/misc/{Velocity_Averager_Linear.gd => velocity_averager_linear.gd} (95%) rename addons/godot-xr-tools/misc/{VR_Common_Shader_Cache.gd => vr_common_shader_cache.gd} (91%) rename addons/godot-xr-tools/misc/{VR_Common_Shader_Cache.tscn => vr_common_shader_cache.tscn} (90%) delete mode 100644 addons/godot-xr-tools/objects/Object_climbable.gd delete mode 100644 addons/godot-xr-tools/objects/Object_climbable.tscn delete mode 100644 addons/godot-xr-tools/objects/Snap_Zone.tscn delete mode 100644 addons/godot-xr-tools/objects/Virtual_Keyboard.tscn create mode 100644 addons/godot-xr-tools/objects/climbable.gd create mode 100644 addons/godot-xr-tools/objects/climbable.tscn rename addons/godot-xr-tools/objects/{Interactable_area.gd => interactable_area.gd} (100%) rename addons/godot-xr-tools/objects/{Interactable_body.gd => interactable_body.gd} (100%) rename addons/godot-xr-tools/objects/keyboard/{VirtualKey.gd => virtual_key.gd} (86%) rename addons/godot-xr-tools/objects/keyboard/{VirtualKey.tscn => virtual_key.tscn} (86%) rename addons/godot-xr-tools/objects/keyboard/{VirtualKeyboard_2D.gd => virtual_keyboard_2d.gd} (83%) rename addons/godot-xr-tools/objects/keyboard/{VirtualKeyboard_2D.tscn => virtual_keyboard_2d.tscn} (99%) rename addons/godot-xr-tools/objects/{Object_pickable.gd => pickable.gd} (99%) rename addons/godot-xr-tools/objects/{Object_pickable.tscn => pickable.tscn} (50%) rename addons/godot-xr-tools/objects/{Snap_Zone.gd => snap_zone.gd} (91%) create mode 100644 addons/godot-xr-tools/objects/snap_zone.tscn rename addons/godot-xr-tools/objects/{Viewport_2D_in_3D.gd => viewport_2d_in_3d.gd} (100%) rename addons/godot-xr-tools/objects/{Viewport_2D_in_3D.tscn => viewport_2d_in_3d.tscn} (82%) rename addons/godot-xr-tools/objects/{Viewport_2D_in_3D_body.gd => viewport_2d_in_3d_body.gd} (99%) create mode 100644 addons/godot-xr-tools/objects/virtual_keyboard.tscn rename addons/godot-xr-tools/objects/{Wind_area.gd => wind_area.gd} (85%) rename addons/godot-xr-tools/objects/{Wind_area.tscn => wind_area.tscn} (79%) delete mode 100644 addons/godot-xr-tools/overrides/GroundPhysics.gd create mode 100644 addons/godot-xr-tools/overrides/ground_physics.gd rename addons/godot-xr-tools/overrides/{GroundPhysics.tscn => ground_physics.tscn} (51%) rename addons/godot-xr-tools/overrides/{GroundPhysicsSettings.gd => ground_physics_settings.gd} (62%) diff --git a/addons/godot-xr-tools/assets/Hand.gd b/addons/godot-xr-tools/assets/hand.gd similarity index 96% rename from addons/godot-xr-tools/assets/Hand.gd rename to addons/godot-xr-tools/assets/hand.gd index a0a3eaba..a6ffae9d 100644 --- a/addons/godot-xr-tools/assets/Hand.gd +++ b/addons/godot-xr-tools/assets/hand.gd @@ -1,4 +1,4 @@ -class_name XRToolsHand, "res://addons/godot-xr-tools/editor/icons/XRToolsHand.svg" +class_name XRToolsHand, "res://addons/godot-xr-tools/editor/icons/hand.svg" extends Spatial @@ -28,7 +28,7 @@ onready var _transform := transform # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: # Scale the hand mesh with the world scale. This is required for OpenXR plugin # 1.3.0 and later where the plugin no-longer scales the controllers with # world_scale @@ -42,14 +42,14 @@ func _process(delta: float) -> void: if controller: var grip = controller.get_joystick_axis(JOY_VR_ANALOG_GRIP) var trigger = controller.get_joystick_axis(JOY_VR_ANALOG_TRIGGER) - + # Uncomment for workaround for bug in OpenXR plugin 1.1.1 and earlier giving values from -1.0 to 1.0 # note that when controller are not being tracking yet this will result in a value of 0.5 # grip = (grip + 1.0) * 0.5 # trigger = (trigger + 1.0) * 0.5 - + $AnimationTree.set("parameters/Grip/blend_amount", grip) $AnimationTree.set("parameters/Trigger/blend_amount", trigger) - + # var grip_state = controller.is_button_pressed(JOY_VR_GRIP) # print("Pressed: " + str(grip_state)) diff --git a/addons/godot-xr-tools/assets/HandBlendTree.tres b/addons/godot-xr-tools/assets/hand_blend_tree.tres similarity index 91% rename from addons/godot-xr-tools/assets/HandBlendTree.tres rename to addons/godot-xr-tools/assets/hand_blend_tree.tres index 9e635e1c..735d6bf9 100644 --- a/addons/godot-xr-tools/assets/HandBlendTree.tres +++ b/addons/godot-xr-tools/assets/hand_blend_tree.tres @@ -30,4 +30,4 @@ nodes/Grip/position = Vector2( 780, 180 ) nodes/Trigger/node = SubResource( 2 ) nodes/Trigger/position = Vector2( 560, 80 ) nodes/output/position = Vector2( 1020, 80 ) -node_connections = [ "output", 0, "Grip", "Trigger", 0, "Default", "Trigger", 1, "Fist", "Grip", 0, "Trigger", "Grip", 1, "Fist2" ] +node_connections = [ "output", 0, "Grip", "Grip", 0, "Trigger", "Grip", 1, "Fist2", "Trigger", 0, "Default", "Trigger", 1, "Fist" ] diff --git a/addons/godot-xr-tools/assets/HandPhysicsBone.gd b/addons/godot-xr-tools/assets/hand_physics_bone.gd similarity index 99% rename from addons/godot-xr-tools/assets/HandPhysicsBone.gd rename to addons/godot-xr-tools/assets/hand_physics_bone.gd index 941db16b..76d67705 100644 --- a/addons/godot-xr-tools/assets/HandPhysicsBone.gd +++ b/addons/godot-xr-tools/assets/hand_physics_bone.gd @@ -12,7 +12,7 @@ extends BoneAttachment ## the hand skeleton, and uses this position to move a CapsuleShape bone ## KinematicBody. ## -## The bone Kinematic is set as top-level and manually driven with the +## The bone Kinematic is set as top-level and manually driven with the ## bones positon and rotation. This is to prevent hand-scaling from scaling ## the Kinematic collision shape, as colliders cannot tolerate being scaled. ## diff --git a/addons/godot-xr-tools/assets/LeftHand.blend b/addons/godot-xr-tools/assets/left_hand.blend similarity index 100% rename from addons/godot-xr-tools/assets/LeftHand.blend rename to addons/godot-xr-tools/assets/left_hand.blend diff --git a/addons/godot-xr-tools/assets/LeftHand.glb b/addons/godot-xr-tools/assets/left_hand.glb similarity index 100% rename from addons/godot-xr-tools/assets/LeftHand.glb rename to addons/godot-xr-tools/assets/left_hand.glb diff --git a/addons/godot-xr-tools/assets/RightHand.glb.import b/addons/godot-xr-tools/assets/left_hand.glb.import similarity index 99% rename from addons/godot-xr-tools/assets/RightHand.glb.import rename to addons/godot-xr-tools/assets/left_hand.glb.import index 7d3e9e05..cfacc13a 100644 --- a/addons/godot-xr-tools/assets/RightHand.glb.import +++ b/addons/godot-xr-tools/assets/left_hand.glb.import @@ -2,12 +2,12 @@ importer="scene" type="PackedScene" -path="res://.import/RightHand.glb-b0ade3e24442d11ee987628909f601b4.scn" +path="res://.import/left_hand.glb-54ab35158cb64aaf29610f7be672554e.scn" [deps] -source_file="res://addons/godot-xr-tools/assets/RightHand.glb" -dest_files=[ "res://.import/RightHand.glb-b0ade3e24442d11ee987628909f601b4.scn" ] +source_file="res://addons/godot-xr-tools/assets/left_hand.glb" +dest_files=[ "res://.import/left_hand.glb-54ab35158cb64aaf29610f7be672554e.scn" ] [params] diff --git a/addons/godot-xr-tools/assets/LeftHand.tscn b/addons/godot-xr-tools/assets/left_hand.tscn similarity index 64% rename from addons/godot-xr-tools/assets/LeftHand.tscn rename to addons/godot-xr-tools/assets/left_hand.tscn index 19abddf0..18cee3c6 100644 --- a/addons/godot-xr-tools/assets/LeftHand.tscn +++ b/addons/godot-xr-tools/assets/left_hand.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.glb" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/Hand.gd" type="Script" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/HandBlendTree.tres" type="AnimationNodeBlendTree" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.glb" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/assets/hand.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/hand_blend_tree.tres" type="AnimationNodeBlendTree" id=3] [node name="LeftHand" type="Spatial"] script = ExtResource( 2 ) diff --git a/addons/godot-xr-tools/assets/LeftPhysicsHand.tscn b/addons/godot-xr-tools/assets/left_physics_hand.tscn similarity index 96% rename from addons/godot-xr-tools/assets/LeftPhysicsHand.tscn rename to addons/godot-xr-tools/assets/left_physics_hand.tscn index 3822fb13..c517a1a1 100644 --- a/addons/godot-xr-tools/assets/LeftPhysicsHand.tscn +++ b/addons/godot-xr-tools/assets/left_physics_hand.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/HandPhysicsBone.gd" type="Script" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/PhysicsHand.gd" type="Script" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/assets/hand_physics_bone.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/physics_hand.gd" type="Script" id=3] [node name="LeftPhysicsHand" instance=ExtResource( 1 )] script = ExtResource( 3 ) diff --git a/addons/godot-xr-tools/assets/PhysicsHand.gd b/addons/godot-xr-tools/assets/physics_hand.gd similarity index 100% rename from addons/godot-xr-tools/assets/PhysicsHand.gd rename to addons/godot-xr-tools/assets/physics_hand.gd diff --git a/addons/godot-xr-tools/assets/PlayerBody.gd b/addons/godot-xr-tools/assets/player_body.gd similarity index 88% rename from addons/godot-xr-tools/assets/PlayerBody.gd rename to addons/godot-xr-tools/assets/player_body.gd index 2d99baa5..fccff75d 100644 --- a/addons/godot-xr-tools/assets/PlayerBody.gd +++ b/addons/godot-xr-tools/assets/player_body.gd @@ -1,5 +1,5 @@ tool -class_name PlayerBody, "res://addons/godot-xr-tools/editor/icons/XRToolsBody.svg" +class_name XRToolsPlayerBody, "res://addons/godot-xr-tools/editor/icons/body.svg" extends Node ## @@ -32,7 +32,7 @@ signal player_bounced(collider, magnitude) const HORIZONTAL := Vector3(1.0, 0.0, 1.0) -## PlayerBody enabled flag +## Player body enabled flag export var enabled := true setget set_enabled ## Player radius @@ -66,25 +66,25 @@ export (int, LAYERS_3D_PHYSICS) var collision_layer = 1 << 19 setget set_collisi export (int, LAYERS_3D_PHYSICS) var collision_mask = 1023 setget set_collision_mask -## Player Velocity - modifiable by MovementProvider nodes +## Player Velocity - modifiable by movement providers var velocity := Vector3.ZERO -## Player On Ground flag - used by MovementProvider nodes +## Player On Ground flag - used by movement providers var on_ground := true -## Ground 'up' vector - used by MovementProvider nodes +## Ground 'up' vector - used by movement providers var ground_vector := Vector3.UP -## Ground slope angle - used by MovementProvider nodes +## Ground slope angle - used by movement providers var ground_angle := 0.0 ## Ground node the player is touching var ground_node: Spatial = null ## Ground physics override (if present) -var ground_physics: GroundPhysicsSettings = null +var ground_physics: XRToolsGroundPhysicsSettings = null -## Ground control velocity - modified by MovementProvider nodes +## Ground control velocity - modified by movement providers var ground_control_velocity := Vector2.ZERO ## Player height offset (for height calibration) @@ -258,12 +258,12 @@ func request_jump(var skip_jump_velocity := false): return # Skip if jump disabled on this ground - var jump_velocity := GroundPhysicsSettings.get_jump_velocity(ground_physics, default_physics) + var jump_velocity := XRToolsGroundPhysicsSettings.get_jump_velocity(ground_physics, default_physics) if jump_velocity == 0.0: return # Skip if the ground is too steep to jump - var max_slope := GroundPhysicsSettings.get_jump_max_slope(ground_physics, default_physics) + var max_slope := XRToolsGroundPhysicsSettings.get_jump_max_slope(ground_physics, default_physics) if ground_angle > max_slope: return @@ -345,8 +345,8 @@ func _update_ground_information(delta: float): ground_node = ground_collision.collider # Select the ground physics - var physics_node := ground_node.get_node_or_null("GroundPhysics") as GroundPhysics - ground_physics = GroundPhysics.get_physics(physics_node, default_physics) + var physics_node := ground_node.get_node_or_null("GroundPhysics") as XRToolsGroundPhysics + ground_physics = XRToolsGroundPhysics.get_physics(physics_node, default_physics) # Detect if we're sliding on a wall # TODO: consider reworking this magic angle @@ -358,7 +358,7 @@ func _update_ground_information(delta: float): var pos_old := _previous_ground_global var pos_new := ground_node.to_global(_previous_ground_local) ground_velocity = (pos_new - pos_old) / delta - + # Update ground velocity information _previous_ground_node = ground_node _previous_ground_global = ground_collision.position @@ -369,7 +369,7 @@ func _update_ground_information(delta: float): func _apply_velocity_and_control(delta: float): # Calculate local velocity var local_velocity := velocity - ground_velocity - + # Split the velocity into horizontal and vertical components var horizontal_velocity := local_velocity * HORIZONTAL var vertical_velocity := local_velocity * Vector3.UP @@ -385,12 +385,12 @@ func _apply_velocity_and_control(delta: float): control_velocity = (dir_forward * -ground_control_velocity.y + dir_right * ground_control_velocity.x) * ARVRServer.world_scale # Apply control velocity to horizontal velocity based on traction - var current_traction := GroundPhysicsSettings.get_move_traction(ground_physics, default_physics) + var current_traction := XRToolsGroundPhysicsSettings.get_move_traction(ground_physics, default_physics) var traction_factor: float = clamp(current_traction * delta, 0.0, 1.0) horizontal_velocity = lerp(horizontal_velocity, control_velocity, traction_factor) # Prevent the player from moving up steep slopes - var current_max_slope := GroundPhysicsSettings.get_move_max_slope(ground_physics, default_physics) + var current_max_slope := XRToolsGroundPhysicsSettings.get_move_max_slope(ground_physics, default_physics) if ground_angle > current_max_slope: # Get a vector in the down-hill direction var down_direction := (ground_vector * HORIZONTAL).normalized() @@ -399,7 +399,7 @@ func _apply_velocity_and_control(delta: float): horizontal_velocity -= down_direction * vdot else: # User is not trying to move, so apply the ground drag - var current_drag := GroundPhysicsSettings.get_move_drag(ground_physics, default_physics) + var current_drag := XRToolsGroundPhysicsSettings.get_move_drag(ground_physics, default_physics) var drag_factor: float = clamp(current_drag * delta, 0, 1) horizontal_velocity = lerp(horizontal_velocity, control_velocity, drag_factor) @@ -414,12 +414,12 @@ func _apply_velocity_and_control(delta: float): # Detect bounciness var collision := kinematic_node.get_slide_collision(0) var collision_node := collision.collider - var collision_physics_node := collision_node.get_node_or_null("GroundPhysics") as GroundPhysics - var collision_physics = GroundPhysics.get_physics(collision_physics_node, default_physics) - var bounce_threshold := GroundPhysicsSettings.get_bounce_threshold(collision_physics, default_physics) - var bounciness := GroundPhysicsSettings.get_bounciness(collision_physics, default_physics) + var collision_physics_node := collision_node.get_node_or_null("GroundPhysics") as XRToolsGroundPhysics + var collision_physics = XRToolsGroundPhysics.get_physics(collision_physics_node, default_physics) + var bounce_threshold := XRToolsGroundPhysicsSettings.get_bounce_threshold(collision_physics, default_physics) + var bounciness := XRToolsGroundPhysicsSettings.get_bounciness(collision_physics, default_physics) var magnitude := -collision.normal.dot(local_velocity) - + # Detect if bounce should be performed if bounciness > 0.0 and magnitude >= bounce_threshold: local_velocity += 2 * collision.normal * magnitude * bounciness @@ -432,16 +432,16 @@ func _apply_velocity_and_control(delta: float): # Get a guaranteed-valid physics func _guaranteed_physics(): - # Ensure we have a guaranteed-valid GroundPhysicsSettings value - var valid_physics := physics as GroundPhysicsSettings + # Ensure we have a guaranteed-valid XRToolsGroundPhysicsSettings value + var valid_physics := physics as XRToolsGroundPhysicsSettings if !valid_physics: - valid_physics = GroundPhysicsSettings.new() + valid_physics = XRToolsGroundPhysicsSettings.new() valid_physics.resource_name = "default" # Return the guaranteed-valid physics return valid_physics -# This method verifies the PlayerBody has a valid configuration. Specifically it +# This method verifies the player body has a valid configuration. Specifically it # checks the following: # - ARVROrigin can be identified # - ARVRCamera can be identified @@ -476,19 +476,19 @@ func _get_configuration_warning(): return "Eyes too far forwards. Move eyes back or decrease camera near clipping plane" # If specified, verify the ground physics is a valid type - if physics and !physics is GroundPhysicsSettings: - return "Physics resource must be a GroundPhysicsSetting" + if physics and !physics is XRToolsGroundPhysicsSettings: + return "Physics resource must be a GroundPhysicsSettings" # Passed basic validation return "" ## Find the Player Body from a player node and an optional path -static func get_player_body(node: Node, path: NodePath = NodePath("")) -> PlayerBody: - var player_body: PlayerBody +static func get_player_body(node: Node, path: NodePath = NodePath("")) -> XRToolsPlayerBody: + var player_body: XRToolsPlayerBody # Try using the node path first if path: - player_body = node.get_node(path) as PlayerBody + player_body = node.get_node(path) as XRToolsPlayerBody if player_body: return player_body @@ -498,13 +498,13 @@ static func get_player_body(node: Node, path: NodePath = NodePath("")) -> Player return null # Attempt to get by the default name - player_body = arvr_origin.get_node_or_null("PlayerBody") as PlayerBody + player_body = arvr_origin.get_node_or_null("PlayerBody") as XRToolsPlayerBody if player_body: return player_body # Search all children of the origin for the player body for child in arvr_origin.get_children(): - player_body = child as PlayerBody + player_body = child as XRToolsPlayerBody if player_body: return player_body diff --git a/addons/godot-xr-tools/assets/PlayerBody.tscn b/addons/godot-xr-tools/assets/player_body.tscn similarity index 84% rename from addons/godot-xr-tools/assets/PlayerBody.tscn rename to addons/godot-xr-tools/assets/player_body.tscn index 67568964..d43d0ce4 100644 --- a/addons/godot-xr-tools/assets/PlayerBody.tscn +++ b/addons/godot-xr-tools/assets/player_body.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.gd" type="Script" id=1] [sub_resource type="CapsuleShape" id=1] radius = 0.4 diff --git a/addons/godot-xr-tools/assets/RightHand.glb b/addons/godot-xr-tools/assets/right_hand.glb similarity index 100% rename from addons/godot-xr-tools/assets/RightHand.glb rename to addons/godot-xr-tools/assets/right_hand.glb diff --git a/addons/godot-xr-tools/assets/LeftHand.glb.import b/addons/godot-xr-tools/assets/right_hand.glb.import similarity index 99% rename from addons/godot-xr-tools/assets/LeftHand.glb.import rename to addons/godot-xr-tools/assets/right_hand.glb.import index a43ff728..f9a35343 100644 --- a/addons/godot-xr-tools/assets/LeftHand.glb.import +++ b/addons/godot-xr-tools/assets/right_hand.glb.import @@ -2,12 +2,12 @@ importer="scene" type="PackedScene" -path="res://.import/LeftHand.glb-7a289350d7a0389e0068af98c6813b91.scn" +path="res://.import/right_hand.glb-8f20889edf64365280173e0ad873b53e.scn" [deps] -source_file="res://addons/godot-xr-tools/assets/LeftHand.glb" -dest_files=[ "res://.import/LeftHand.glb-7a289350d7a0389e0068af98c6813b91.scn" ] +source_file="res://addons/godot-xr-tools/assets/right_hand.glb" +dest_files=[ "res://.import/right_hand.glb-8f20889edf64365280173e0ad873b53e.scn" ] [params] diff --git a/addons/godot-xr-tools/assets/RightHand.tscn b/addons/godot-xr-tools/assets/right_hand.tscn similarity index 64% rename from addons/godot-xr-tools/assets/RightHand.tscn rename to addons/godot-xr-tools/assets/right_hand.tscn index 621f3be0..30185688 100644 --- a/addons/godot-xr-tools/assets/RightHand.tscn +++ b/addons/godot-xr-tools/assets/right_hand.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/godot-xr-tools/assets/HandBlendTree.tres" type="AnimationNodeBlendTree" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/Hand.gd" type="Script" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.glb" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/hand_blend_tree.tres" type="AnimationNodeBlendTree" id=1] +[ext_resource path="res://addons/godot-xr-tools/assets/hand.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.glb" type="PackedScene" id=3] [node name="RightHand" type="Spatial"] script = ExtResource( 2 ) diff --git a/addons/godot-xr-tools/assets/RightPhysicsHand.tscn b/addons/godot-xr-tools/assets/right_physics_hand.tscn similarity index 96% rename from addons/godot-xr-tools/assets/RightPhysicsHand.tscn rename to addons/godot-xr-tools/assets/right_physics_hand.tscn index 3d42f81f..8c8589c4 100644 --- a/addons/godot-xr-tools/assets/RightPhysicsHand.tscn +++ b/addons/godot-xr-tools/assets/right_physics_hand.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/HandPhysicsBone.gd" type="Script" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/PhysicsHand.gd" type="Script" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/assets/hand_physics_bone.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/physics_hand.gd" type="Script" id=3] [node name="RightPhysicsHand" instance=ExtResource( 1 )] script = ExtResource( 3 ) diff --git a/addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg.import b/addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg.import deleted file mode 100644 index dfb7ff3c..00000000 --- a/addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg.import +++ /dev/null @@ -1,35 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/XRToolsMovementProvider.svg-f3adbbe721430aa313978b9cb724c5cd.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg" -dest_files=[ "res://.import/XRToolsMovementProvider.svg-f3adbbe721430aa313978b9cb724c5cd.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -process/normal_map_invert_y=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/addons/godot-xr-tools/editor/icons/XRToolsBody.svg b/addons/godot-xr-tools/editor/icons/body.svg similarity index 100% rename from addons/godot-xr-tools/editor/icons/XRToolsBody.svg rename to addons/godot-xr-tools/editor/icons/body.svg diff --git a/addons/godot-xr-tools/editor/icons/XRToolsHand.svg.import b/addons/godot-xr-tools/editor/icons/body.svg.import similarity index 68% rename from addons/godot-xr-tools/editor/icons/XRToolsHand.svg.import rename to addons/godot-xr-tools/editor/icons/body.svg.import index d7900987..1e8d1742 100644 --- a/addons/godot-xr-tools/editor/icons/XRToolsHand.svg.import +++ b/addons/godot-xr-tools/editor/icons/body.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/XRToolsHand.svg-61051cd7afee04c5c901b73a96c00708.stex" +path="res://.import/body.svg-324e141d452c32f3136ca97c338025b4.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot-xr-tools/editor/icons/XRToolsHand.svg" -dest_files=[ "res://.import/XRToolsHand.svg-61051cd7afee04c5c901b73a96c00708.stex" ] +source_file="res://addons/godot-xr-tools/editor/icons/body.svg" +dest_files=[ "res://.import/body.svg-324e141d452c32f3136ca97c338025b4.stex" ] [params] diff --git a/addons/godot-xr-tools/editor/icons/XRToolsFunction.svg b/addons/godot-xr-tools/editor/icons/function.svg similarity index 100% rename from addons/godot-xr-tools/editor/icons/XRToolsFunction.svg rename to addons/godot-xr-tools/editor/icons/function.svg diff --git a/addons/godot-xr-tools/editor/icons/XRToolsNode.svg.import b/addons/godot-xr-tools/editor/icons/function.svg.import similarity index 68% rename from addons/godot-xr-tools/editor/icons/XRToolsNode.svg.import rename to addons/godot-xr-tools/editor/icons/function.svg.import index 163f0662..3994debd 100644 --- a/addons/godot-xr-tools/editor/icons/XRToolsNode.svg.import +++ b/addons/godot-xr-tools/editor/icons/function.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/XRToolsNode.svg-bb3085c65c8e095f4f6650d57c13b728.stex" +path="res://.import/function.svg-52c5f936037e0f38a4da2b1e16ae67fe.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot-xr-tools/editor/icons/XRToolsNode.svg" -dest_files=[ "res://.import/XRToolsNode.svg-bb3085c65c8e095f4f6650d57c13b728.stex" ] +source_file="res://addons/godot-xr-tools/editor/icons/function.svg" +dest_files=[ "res://.import/function.svg-52c5f936037e0f38a4da2b1e16ae67fe.stex" ] [params] diff --git a/addons/godot-xr-tools/editor/icons/XRToolsHand.svg b/addons/godot-xr-tools/editor/icons/hand.svg similarity index 100% rename from addons/godot-xr-tools/editor/icons/XRToolsHand.svg rename to addons/godot-xr-tools/editor/icons/hand.svg diff --git a/addons/godot-xr-tools/editor/icons/XRToolsBody.svg.import b/addons/godot-xr-tools/editor/icons/hand.svg.import similarity index 68% rename from addons/godot-xr-tools/editor/icons/XRToolsBody.svg.import rename to addons/godot-xr-tools/editor/icons/hand.svg.import index c70be0e2..bb4a971d 100644 --- a/addons/godot-xr-tools/editor/icons/XRToolsBody.svg.import +++ b/addons/godot-xr-tools/editor/icons/hand.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/XRToolsBody.svg-2163d8dc75151d215d9d9c0dc904d78b.stex" +path="res://.import/hand.svg-a05486d804ef16320d6cf54e06292b8f.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot-xr-tools/editor/icons/XRToolsBody.svg" -dest_files=[ "res://.import/XRToolsBody.svg-2163d8dc75151d215d9d9c0dc904d78b.stex" ] +source_file="res://addons/godot-xr-tools/editor/icons/hand.svg" +dest_files=[ "res://.import/hand.svg-a05486d804ef16320d6cf54e06292b8f.stex" ] [params] diff --git a/addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg b/addons/godot-xr-tools/editor/icons/movement_provider.svg similarity index 100% rename from addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg rename to addons/godot-xr-tools/editor/icons/movement_provider.svg diff --git a/addons/godot-xr-tools/editor/icons/movement_provider.svg.import b/addons/godot-xr-tools/editor/icons/movement_provider.svg.import new file mode 100644 index 00000000..877a3580 --- /dev/null +++ b/addons/godot-xr-tools/editor/icons/movement_provider.svg.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/movement_provider.svg-3c994cf0a3775c20f333be563d69fbf8.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godot-xr-tools/editor/icons/movement_provider.svg" +dest_files=[ "res://.import/movement_provider.svg-3c994cf0a3775c20f333be563d69fbf8.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/addons/godot-xr-tools/editor/icons/XRToolsNode.svg b/addons/godot-xr-tools/editor/icons/node.svg similarity index 100% rename from addons/godot-xr-tools/editor/icons/XRToolsNode.svg rename to addons/godot-xr-tools/editor/icons/node.svg diff --git a/addons/godot-xr-tools/editor/icons/XRToolsFunction.svg.import b/addons/godot-xr-tools/editor/icons/node.svg.import similarity index 67% rename from addons/godot-xr-tools/editor/icons/XRToolsFunction.svg.import rename to addons/godot-xr-tools/editor/icons/node.svg.import index c031f3c1..49ae5fa7 100644 --- a/addons/godot-xr-tools/editor/icons/XRToolsFunction.svg.import +++ b/addons/godot-xr-tools/editor/icons/node.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/XRToolsFunction.svg-f9f5b9785f1d9a3a8c6ad043ae799cb1.stex" +path="res://.import/node.svg-37d53571b4a4459efefcc791c5402b4f.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot-xr-tools/editor/icons/XRToolsFunction.svg" -dest_files=[ "res://.import/XRToolsFunction.svg-f9f5b9785f1d9a3a8c6ad043ae799cb1.stex" ] +source_file="res://addons/godot-xr-tools/editor/icons/node.svg" +dest_files=[ "res://.import/node.svg-37d53571b4a4459efefcc791c5402b4f.stex" ] [params] diff --git a/addons/godot-xr-tools/effects/vignette.gd b/addons/godot-xr-tools/effects/vignette.gd index f243d63a..2c8996d3 100644 --- a/addons/godot-xr-tools/effects/vignette.gd +++ b/addons/godot-xr-tools/effects/vignette.gd @@ -145,10 +145,10 @@ func _process(delta): # Adjust radius based on rotation speed of our origin point (not of head movement). # We convert our delta rotation to a quaterion. - # A quaternion represents a rotation around an angle. + # A quaternion represents a rotation around an angle. var q = delta_b.get_rotation_quat() - # We get our angle from our w component and then adjust to get a + # We get our angle from our w component and then adjust to get a # rotation speed per second by dividing by delta var angle = (2 * acos(q.w)) / delta @@ -168,7 +168,7 @@ func _process(delta): fade_delay = auto_fade_delay elif fade_delay > 0.0: fade_delay -= delta - else: + else: set_radius(clamp(radius + delta / auto_fade_out_factor, 0.0, 1.0)) last_origin_basis = origin_node.global_transform.basis @@ -181,9 +181,9 @@ func _process(delta): func _get_configuration_warning(): # Check the origin node var node = _get_origin_node() - if !node: + if !node: return "Parent node must be in a branch from ARVROrigin" - + # check camera node var parent = get_parent() if !parent or !parent is ARVRCamera: diff --git a/addons/godot-xr-tools/examples/Function_Fall_damage.tscn b/addons/godot-xr-tools/examples/Function_Fall_damage.tscn deleted file mode 100644 index 78162dd2..00000000 --- a/addons/godot-xr-tools/examples/Function_Fall_damage.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/examples/Function_Fall_damage.gd" type="Script" id=1] - -[node name="Function_Fall_damage" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/examples/Function_Fall_damage.gd b/addons/godot-xr-tools/examples/fall_damage.gd similarity index 93% rename from addons/godot-xr-tools/examples/Function_Fall_damage.gd rename to addons/godot-xr-tools/examples/fall_damage.gd index 1edd5e87..4ae35de6 100644 --- a/addons/godot-xr-tools/examples/Function_Fall_damage.gd +++ b/addons/godot-xr-tools/examples/fall_damage.gd @@ -1,6 +1,6 @@ tool -class_name Function_FallDamage -extends MovementProvider +class_name XRToolsFallDamage +extends XRToolsMovementProvider ## @@ -14,7 +14,7 @@ extends MovementProvider ## changes (acceleration) exceeding a threshold. ## ## This doesn't use the usual Acceleration = dV / dT as it doesn't appear -## to work too well considering the "instantaneous" nature of the +## to work too well considering the "instantaneous" nature of the ## collision. Additionally all it would end up doing is multiplying the ## change in velocity by the physics-frame-rate making it sensitive to ## varying physics timing. @@ -55,7 +55,7 @@ func _ready(): # Set as always active is_active = true -func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): +func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Skip if not enabled if disabled or !enabled: _previous_velocity = player_body.velocity diff --git a/addons/godot-xr-tools/examples/fall_damage.tscn b/addons/godot-xr-tools/examples/fall_damage.tscn new file mode 100644 index 00000000..a96970f6 --- /dev/null +++ b/addons/godot-xr-tools/examples/fall_damage.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/examples/fall_damage.gd" type="Script" id=1] + +[node name="FallDamage" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Climb_movement.tscn b/addons/godot-xr-tools/functions/Function_Climb_movement.tscn deleted file mode 100644 index 2039ebd1..00000000 --- a/addons/godot-xr-tools/functions/Function_Climb_movement.tscn +++ /dev/null @@ -1,8 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Climb_movement.gd" type="Script" id=1] - -[node name="Function_Climb_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) -left_pickup = null -right_pickup = null diff --git a/addons/godot-xr-tools/functions/Function_Crouch_movement.tscn b/addons/godot-xr-tools/functions/Function_Crouch_movement.tscn deleted file mode 100644 index 781876c6..00000000 --- a/addons/godot-xr-tools/functions/Function_Crouch_movement.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Crouch_movement.gd" type="Script" id=1] - -[node name="Function_Crouch_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Direct_movement.tscn b/addons/godot-xr-tools/functions/Function_Direct_movement.tscn deleted file mode 100644 index d981d495..00000000 --- a/addons/godot-xr-tools/functions/Function_Direct_movement.tscn +++ /dev/null @@ -1,11 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.gd" type="Script" id=1] - -[node name="Function_Direct_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) -smooth_rotation = false -smooth_turn_speed = 2.0 -step_turn_delay = 0.2 -step_turn_angle = 20.0 -move_type = 0 diff --git a/addons/godot-xr-tools/functions/Function_Flight_movement.tscn b/addons/godot-xr-tools/functions/Function_Flight_movement.tscn deleted file mode 100644 index c8fdfc5b..00000000 --- a/addons/godot-xr-tools/functions/Function_Flight_movement.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Flight_movement.gd" type="Script" id=1] - -[node name="Function_Flight_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Glide_movement.tscn b/addons/godot-xr-tools/functions/Function_Glide_movement.tscn deleted file mode 100644 index 38da3218..00000000 --- a/addons/godot-xr-tools/functions/Function_Glide_movement.tscn +++ /dev/null @@ -1,8 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Glide_movement.gd" type="Script" id=1] - -[node name="Function_Glide_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) -left_controller = null -right_controller = null diff --git a/addons/godot-xr-tools/functions/Function_JumpDetect_movement.tscn b/addons/godot-xr-tools/functions/Function_JumpDetect_movement.tscn deleted file mode 100644 index 00cfd6de..00000000 --- a/addons/godot-xr-tools/functions/Function_JumpDetect_movement.tscn +++ /dev/null @@ -1,7 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_JumpDetect_movement.gd" type="Script" id=1] - -[node name="Function_JumpDetect_Movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) -arms_jump_enable = true diff --git a/addons/godot-xr-tools/functions/Function_Jump_movement.tscn b/addons/godot-xr-tools/functions/Function_Jump_movement.tscn deleted file mode 100644 index b84598b7..00000000 --- a/addons/godot-xr-tools/functions/Function_Jump_movement.tscn +++ /dev/null @@ -1,7 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Jump_movement.gd" type="Script" id=1] - -[node name="Function_Jump_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) -jump_button_id = null diff --git a/addons/godot-xr-tools/functions/Function_Pickup.tscn b/addons/godot-xr-tools/functions/Function_Pickup.tscn deleted file mode 100644 index b845df73..00000000 --- a/addons/godot-xr-tools/functions/Function_Pickup.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.gd" type="Script" id=1] - -[node name="Function_Pickup" type="Spatial"] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Turn_movement.tscn b/addons/godot-xr-tools/functions/Function_Turn_movement.tscn deleted file mode 100644 index b636b6d2..00000000 --- a/addons/godot-xr-tools/functions/Function_Turn_movement.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.gd" type="Script" id=1] - -[node name="Function_Turn_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Wind_movement.tscn b/addons/godot-xr-tools/functions/Function_Wind_movement.tscn deleted file mode 100644 index b974d350..00000000 --- a/addons/godot-xr-tools/functions/Function_Wind_movement.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Wind_movement.gd" type="Script" id=1] - -[node name="Function_Wind_movement" type="Node" groups=["movement_providers"]] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Pickup.gd b/addons/godot-xr-tools/functions/function_pickup.gd similarity index 98% rename from addons/godot-xr-tools/functions/Function_Pickup.gd rename to addons/godot-xr-tools/functions/function_pickup.gd index d93c3147..d672fcd6 100644 --- a/addons/godot-xr-tools/functions/Function_Pickup.gd +++ b/addons/godot-xr-tools/functions/function_pickup.gd @@ -1,4 +1,4 @@ -class_name Function_Pickup, "res://addons/godot-xr-tools/editor/icons/XRToolsFunction.svg" +class_name XRToolsFunctionPickup, "res://addons/godot-xr-tools/editor/icons/function.svg" extends Spatial @@ -71,7 +71,7 @@ var picked_up_ranged: bool = false # Private fields var _object_in_grab_area = Array() var _object_in_ranged_area = Array() -var _velocity_averager = VelocityAverager.new(velocity_samples) +var _velocity_averager = XRToolsVelocityAverager.new(velocity_samples) var _grab_area: Area var _grab_collision: CollisionShape var _ranged_area: Area @@ -325,7 +325,7 @@ func _pick_up_object(target: Spatial) -> void: return # Handle snap-zone - var snap := target as XRTSnapZone + var snap := target as XRToolsSnapZone if snap: target = snap.picked_up_object snap.drop_object() diff --git a/addons/godot-xr-tools/functions/function_pickup.tscn b/addons/godot-xr-tools/functions/function_pickup.tscn new file mode 100644 index 00000000..14aeacfa --- /dev/null +++ b/addons/godot-xr-tools/functions/function_pickup.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/function_pickup.gd" type="Script" id=1] + +[node name="FunctionPickup" type="Spatial"] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_pointer.gd b/addons/godot-xr-tools/functions/function_pointer.gd similarity index 99% rename from addons/godot-xr-tools/functions/Function_pointer.gd rename to addons/godot-xr-tools/functions/function_pointer.gd index 166f999f..125f7ca9 100644 --- a/addons/godot-xr-tools/functions/Function_pointer.gd +++ b/addons/godot-xr-tools/functions/function_pointer.gd @@ -40,7 +40,7 @@ var ws = 1.0 func set_enabled(p_enabled): enabled = p_enabled - + # this gets called before our scene is ready, we'll call this again in _ready to enable this if is_inside_tree(): $Laser.visible = p_enabled and show_laser @@ -83,7 +83,7 @@ func _button_pressed(): if $RayCast.is_colliding(): target = $RayCast.get_collider() last_collided_at = $RayCast.get_collision_point() - + if target.has_signal("pointer_pressed"): target.emit_signal("pointer_pressed", last_collided_at) elif target.has_method("pointer_pressed"): @@ -95,7 +95,7 @@ func _button_released(): target.emit_signal("pointer_released", last_collided_at) elif target.has_method("pointer_released"): target.pointer_released(last_collided_at) - + # unset target target = null last_collided_at = Vector3(0, 0, 0) @@ -110,12 +110,12 @@ func _on_button_release(p_button): func _ready(): ws = ARVRServer.world_scale - + if active_button != Buttons.VR_ACTION: # Get button press feedback from our parent (should be an ARVRController) get_parent().connect("button_pressed", self, "_on_button_pressed") get_parent().connect("button_release", self, "_on_button_release") - + # init our state set_y_offset(y_offset) set_distance(distance) @@ -125,24 +125,24 @@ func _ready(): set_collide_with_areas(collide_with_areas) set_enabled(enabled) -func _process(delta): +func _process(_delta): if !is_inside_tree(): return - + if active_button == Buttons.VR_ACTION and action != "": if Input.is_action_just_pressed(action): _button_pressed() elif !Input.is_action_pressed(action) and target: _button_released() - + var new_ws = ARVRServer.world_scale if (ws != new_ws): ws = new_ws set_y_offset(y_offset) - + if enabled and $RayCast.is_colliding(): var new_at = $RayCast.get_collision_point() - + if is_instance_valid(target): # if target is set our mouse must be down, we keep "focus" on our target if new_at != last_collided_at: @@ -189,6 +189,6 @@ func _process(delta): last_target.emit_signal("pointer_exited") elif last_target.has_method("pointer_exited"): last_target.pointer_exited() - + last_target = null $Target.visible = false diff --git a/addons/godot-xr-tools/functions/Function_pointer.tscn b/addons/godot-xr-tools/functions/function_pointer.tscn similarity index 84% rename from addons/godot-xr-tools/functions/Function_pointer.tscn rename to addons/godot-xr-tools/functions/function_pointer.tscn index aae2a740..26ae43e5 100644 --- a/addons/godot-xr-tools/functions/Function_pointer.tscn +++ b/addons/godot-xr-tools/functions/function_pointer.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://addons/godot-xr-tools/materials/pointer.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_pointer.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pointer.gd" type="Script" id=2] [sub_resource type="CubeMesh" id=1] resource_local_to_scene = true @@ -14,8 +14,7 @@ height = 0.1 radial_segments = 16 rings = 8 -[node name="Function_pointer" type="Spatial"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +[node name="FunctionPointer" type="Spatial"] script = ExtResource( 2 ) collision_mask = 524287 diff --git a/addons/godot-xr-tools/functions/Function_Teleport.gd b/addons/godot-xr-tools/functions/function_teleport.gd similarity index 98% rename from addons/godot-xr-tools/functions/Function_Teleport.gd rename to addons/godot-xr-tools/functions/function_teleport.gd index 3ed7fb99..49053a02 100644 --- a/addons/godot-xr-tools/functions/Function_Teleport.gd +++ b/addons/godot-xr-tools/functions/function_teleport.gd @@ -4,9 +4,6 @@ extends KinematicBody # Add this scene as a sub scene of your ARVRController node to implement a teleport function on that controller. -# Is this active? -export var enabled = true setget set_enabled, get_enabled - # enum our buttons, should find a way to put this more central enum Buttons { VR_BUTTON_BY = 1, @@ -26,6 +23,9 @@ enum Buttons { VR_TRIGGER = 15 } +# Is this active? +export var enabled = true setget set_enabled, get_enabled + export (Buttons) var teleport_button = Buttons.VR_TRIGGER export var can_teleport_color: Color = Color(0.0, 1.0, 0.0, 1.0) export var cant_teleport_color: Color = Color(1.0, 0.0, 0.0, 1.0) @@ -42,7 +42,6 @@ export (int, LAYERS_3D_PHYSICS) var valid_teleport_mask = ~0 # We don't know the name of the camera node... export var camera: NodePath -onready var ws = ARVRServer.world_scale var origin_node = null var camera_node = null var is_on_floor = true @@ -54,6 +53,8 @@ var last_target_transform = Transform() var collision_shape = null var step_size = 0.5 +onready var ws = ARVRServer.world_scale + # By default we show a capsule to indicate where the player lands. # Turn on editable children, # hide the capsule, @@ -102,36 +103,36 @@ func set_player_radius(p_radius): func _get_configuration_warning(): if camera == null: return "You need to assign a camera" - + return "" func _ready(): if !Engine.editor_hint: # We should be a child of an ARVRController and it should be a child or our ARVROrigin origin_node = get_node("../..") - + # It's inactive when we start $Teleport.visible = false $Target.visible = false - + # Scale to our world scale $Teleport.mesh.size = Vector2(0.05 * ws, 1.0) $Target.mesh.size = Vector2(ws, ws) $Target/Player_figure.scale = Vector3(ws, ws, ws) - + if camera: camera_node = get_node(camera) else: # see if we can find our default camera_node = origin_node.get_node('ARVRCamera') - + # get our capsule shape collision_shape = $CollisionShape.shape $CollisionShape.shape = null - + # now remove our collision shape, we are not using our kinematic body remove_child($CollisionShape) - + # call set player to ensure our collision shape is sized set_player_height(player_height) set_player_radius(player_radius) @@ -140,24 +141,24 @@ func _physics_process(delta): if !Engine.editor_hint: # We should be the child or the controller on which the teleport is implemented var controller = get_parent() - + if !origin_node: return - + if !camera_node: return - + # if we're not enabled no point in doing mode if !enabled: # reset these is_teleporting = false; $Teleport.visible = false $Target.visible = false - + # and stop this from running until we enable again set_physics_process(false) return - + # check if our world scale has changed.. var new_ws = ARVRServer.world_scale if ws != new_ws: @@ -165,32 +166,32 @@ func _physics_process(delta): $Teleport.mesh.size = Vector2(0.05 * ws, 1.0) $Target.mesh.size = Vector2(ws, ws) $Target/Player_figure.scale = Vector3(ws, ws, ws) - + if controller and controller.get_is_active() and controller.is_button_pressed(teleport_button): if !is_teleporting: is_teleporting = true $Teleport.visible = true $Target.visible = true teleport_rotation = 0.0 - + # get our physics engine state var space = PhysicsServer.body_get_space(self.get_rid()) var state = PhysicsServer.space_get_direct_state(space) var query = PhysicsShapeQueryParameters.new() - + # init stuff about our query that doesn't change query.collision_mask = collision_mask query.margin = get_safe_margin() query.shape_rid = collision_shape.get_rid() - + # make a transform for rotating and offseting our shape, it's always lying on its side by default... var shape_transform = Transform(Basis(Vector3(1.0, 0.0, 0.0), deg2rad(90.0)), Vector3(0.0, player_height / 2.0, 0.0)) - + # update location var teleport_global_transform = $Teleport.global_transform var target_global_origin = teleport_global_transform.origin var down = Vector3(0.0, -1.0 / ws, 0.0) - + ############################################################ # New teleport logic # We're going to use test move in steps to find out where we hit something... @@ -203,17 +204,17 @@ func _physics_process(delta): for i in range(1,26): var new_cast_length = cast_length + (step_size / fine_tune) var global_target = Vector3(0.0, 0.0, -new_cast_length) - + # our quadratic values var t = global_target.z / strength var t2 = t * t - + # target to world space global_target = teleport_global_transform.xform(global_target) - + # adjust for gravity global_target += down * t2 - + # test our new location for collisions query.transform = Transform(Basis(), global_target) * shape_transform var cast_result = state.collide_shape(query, 10) @@ -227,7 +228,7 @@ func _physics_process(delta): else: # if we don't collide make sure we keep using our current origin point var collided_at = target_global_origin - + # check for collision if global_target.y > target_global_origin.y: # if we're moving up, we hit the ceiling of something, we don't really care what @@ -236,7 +237,7 @@ func _physics_process(delta): # now we cast a ray downwards to see if we're on a surface var start_pos = target_global_origin + (Vector3.UP * 0.5 * player_height) var end_pos = target_global_origin - (Vector3.UP * 1.1 * player_height) - + var intersects = state.intersect_ray(start_pos, end_pos, [], collision_mask) if intersects.empty(): is_on_floor = false @@ -244,29 +245,29 @@ func _physics_process(delta): # did we collide with a floor or a wall? floor_normal = intersects["normal"] var dot = floor_normal.dot(Vector3.UP) - + if dot > max_slope_cos: is_on_floor = true else: is_on_floor = false - + # Update our collision point if it's moved enough, this solves a little bit of jittering var diff = collided_at - intersects["position"] - + if diff.length() > 0.1: collided_at = intersects["position"] - + # Fail if the hit target isn't in our valid mask var collider_mask = intersects["collider"].collision_layer if not valid_teleport_mask & collider_mask: is_on_floor = false - + # we are colliding, find our if we're colliding on a wall or floor, one we can do, the other nope... cast_length += (collided_at - target_global_origin).length() target_global_origin = collided_at hit_something = true break - + # and just update our shader $Teleport.get_surface_material(0).set_shader_param("scale_t", 1.0 / strength) $Teleport.get_surface_material(0).set_shader_param("ws", ws) @@ -281,22 +282,22 @@ func _physics_process(delta): else: can_teleport = false color = cant_teleport_color - + # check our axis to see if we need to rotate teleport_rotation += (delta * controller.get_joystick_axis(0) * -4.0) - + # update target and colour var target_basis = Basis() target_basis.z = Vector3(teleport_global_transform.basis.z.x, 0.0, teleport_global_transform.basis.z.z).normalized() target_basis.y = normal target_basis.x = target_basis.y.cross(target_basis.z) target_basis.z = target_basis.x.cross(target_basis.y) - + target_basis = target_basis.rotated(normal, teleport_rotation) last_target_transform.basis = target_basis last_target_transform.origin = target_global_origin + Vector3(0.0, 0.001, 0.0) $Target.global_transform = last_target_transform - + $Teleport.get_surface_material(0).set_shader_param("mix_color", color) $Target.get_surface_material(0).albedo_color = color $Target.visible = can_teleport @@ -306,27 +307,27 @@ func _physics_process(delta): $Teleport.get_surface_material(0).set_shader_param("mix_color", no_collision_color) elif is_teleporting: if can_teleport: - + # make our target horizontal again var new_transform = last_target_transform new_transform.basis.y = Vector3(0.0, 1.0, 0.0) new_transform.basis.x = new_transform.basis.y.cross(new_transform.basis.z).normalized() new_transform.basis.z = new_transform.basis.x.cross(new_transform.basis.y).normalized() - + # find out our user's feet's transformation var cam_transform = camera_node.transform var user_feet_transform = Transform() user_feet_transform.origin = cam_transform.origin user_feet_transform.origin.y = 0 # the feet are on the ground, but have the same X,Z as the camera - + # ensure this transform is upright user_feet_transform.basis.y = Vector3(0.0, 1.0, 0.0) user_feet_transform.basis.x = user_feet_transform.basis.y.cross(cam_transform.basis.z).normalized() user_feet_transform.basis.z = user_feet_transform.basis.x.cross(user_feet_transform.basis.y).normalized() - + # now move the origin such that the new global user_feet_transform would be == new_transform origin_node.global_transform = new_transform * user_feet_transform.inverse() - + # and disable is_teleporting = false; $Teleport.visible = false diff --git a/addons/godot-xr-tools/functions/Function_Teleport.tscn b/addons/godot-xr-tools/functions/function_teleport.tscn similarity index 81% rename from addons/godot-xr-tools/functions/Function_Teleport.tscn rename to addons/godot-xr-tools/functions/function_teleport.tscn index 4f6dab8a..60e5726f 100644 --- a/addons/godot-xr-tools/functions/Function_Teleport.tscn +++ b/addons/godot-xr-tools/functions/function_teleport.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=9 format=2] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Teleport.gd" type="Script" id=1] -[ext_resource path="res://addons/godot-xr-tools/materials/teleport.tres" type="Material" id=2] -[ext_resource path="res://addons/godot-xr-tools/materials/target.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/materials/capule.tres" type="Material" id=4] +[ext_resource path="res://addons/godot-xr-tools/materials/target.tres" type="Material" id=1] +[ext_resource path="res://addons/godot-xr-tools/materials/capule.tres" type="Material" id=2] +[ext_resource path="res://addons/godot-xr-tools/materials/teleport.tres" type="Material" id=3] +[ext_resource path="res://addons/godot-xr-tools/functions/function_teleport.gd" type="Script" id=4] [sub_resource type="PlaneMesh" id=1] size = Vector2( 0.05, 1 ) @@ -19,30 +19,29 @@ radius = 0.4 radius = 0.1 height = 0.1 -[node name="Function_Teleport" type="KinematicBody"] -input_ray_pickable = false +[node name="FunctionTeleport" type="KinematicBody"] collision_layer = 524288 collision_mask = 1023 +input_ray_pickable = false collision/safe_margin = 0.01 -script = ExtResource( 1 ) +script = ExtResource( 4 ) no_collision_color = Color( 0.176471, 0.313726, 0.862745, 1 ) -camera = null [node name="Teleport" type="MeshInstance" parent="."] mesh = SubResource( 1 ) -material/0 = ExtResource( 2 ) +material/0 = ExtResource( 3 ) [node name="Target" type="MeshInstance" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -4.92359 ) mesh = SubResource( 2 ) -material/0 = ExtResource( 3 ) +material/0 = ExtResource( 1 ) [node name="Player_figure" type="Position3D" parent="Target"] [node name="Capsule" type="MeshInstance" parent="Target/Player_figure"] transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.9, 0 ) mesh = SubResource( 3 ) -material/0 = ExtResource( 4 ) +material/0 = ExtResource( 2 ) [node name="CollisionShape" type="CollisionShape" parent="."] transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0 ) diff --git a/addons/godot-xr-tools/functions/Function_Climb_movement.gd b/addons/godot-xr-tools/functions/movement_climb.gd similarity index 80% rename from addons/godot-xr-tools/functions/Function_Climb_movement.gd rename to addons/godot-xr-tools/functions/movement_climb.gd index 018680b4..15cccc47 100644 --- a/addons/godot-xr-tools/functions/Function_Climb_movement.gd +++ b/addons/godot-xr-tools/functions/movement_climb.gd @@ -1,17 +1,16 @@ tool -class_name Function_ClimbMovement -extends MovementProvider +class_name XRToolsMovementClimb +extends XRToolsMovementProvider ## ## Movement Provider for Climbing ## ## @desc: -## This script works with the Function_Climb_movement asset to provide -## climbing movement for the player. This script works with the PlayerBody -## attached to the players ARVROrigin. +## This script provides climbing movement for the player. This script works +## with the PlayerBody attached to the players ARVROrigin. ## ## StaticBody objects can be marked as climbable by adding the -## Object_climbable script to them +## object climbable script to them ## ## When climbing, the global velocity of the PlayerBody is averaged for ## velocity_averages samples, and upon release the velocity is applied @@ -55,23 +54,23 @@ var _deltas = Array() # Node references -onready var _left_pickup_node: Function_Pickup = get_node(left_pickup) -onready var _right_pickup_node: Function_Pickup = get_node(right_pickup) +onready var _left_pickup_node: XRToolsFunctionPickup = get_node(left_pickup) +onready var _right_pickup_node: XRToolsFunctionPickup = get_node(right_pickup) -func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Disable climbing if requested if disabled or !enabled: _set_climbing(false, player_body) return # Get the left-hand climbable - var left_climbable := _left_pickup_node.picked_up_object as Object_climbable + var left_climbable := _left_pickup_node.picked_up_object as XRToolsClimbable if !is_instance_valid(left_climbable): left_climbable = null # Get the right-hand climbable - var right_climbable := _right_pickup_node.picked_up_object as Object_climbable + var right_climbable := _right_pickup_node.picked_up_object as XRToolsClimbable if !is_instance_valid(right_climbable): right_climbable = null @@ -110,7 +109,7 @@ func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): return true -func _set_climbing(active: bool, player_body: PlayerBody) -> void: +func _set_climbing(active: bool, player_body: XRToolsPlayerBody) -> void: # Skip if no change if active == is_active: return @@ -156,17 +155,17 @@ func _average_velocity() -> Vector3: # Return the average return total_distance / total_time -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Verify the left controller var test_left_pickup_node = get_node_or_null(left_pickup) if left_pickup else null - if !test_left_pickup_node or !test_left_pickup_node is Function_Pickup: - return "Unable to find left Function_Pickup" + if !test_left_pickup_node or !test_left_pickup_node is XRToolsFunctionPickup: + return "Unable to find left FunctionPickup" # Verify the right controller var test_right_pickup_node = get_node_or_null(right_pickup) if right_pickup else null - if !test_right_pickup_node or !test_right_pickup_node is Function_Pickup: - return "Unable to find right Function_Pickup" + if !test_right_pickup_node or !test_right_pickup_node is XRToolsFunctionPickup: + return "Unable to find right FunctionPickup" # Verify velocity averages if velocity_averages < 2: diff --git a/addons/godot-xr-tools/functions/movement_climb.tscn b/addons/godot-xr-tools/functions/movement_climb.tscn new file mode 100644 index 00000000..05be2f54 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_climb.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_climb.gd" type="Script" id=1] + +[node name="MovementClimb" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Crouch_movement.gd b/addons/godot-xr-tools/functions/movement_crouch.gd similarity index 87% rename from addons/godot-xr-tools/functions/Function_Crouch_movement.gd rename to addons/godot-xr-tools/functions/movement_crouch.gd index 5b1630c6..fa276ee8 100644 --- a/addons/godot-xr-tools/functions/Function_Crouch_movement.gd +++ b/addons/godot-xr-tools/functions/movement_crouch.gd @@ -1,6 +1,6 @@ tool -class_name Function_CrouchMovement -extends MovementProvider +class_name XRToolsMovementCrouch +extends XRToolsMovementProvider ## ## Movement Provider for Crouching @@ -8,6 +8,7 @@ extends MovementProvider ## @desc: ## This script works with the PlayerBody attached to the players ARVROrigin. ## + ## When the player presses the selected button, the height is overridden ## to the crouch height ## @@ -52,7 +53,7 @@ onready var _controller : ARVRController = get_parent() # Perform jump movement -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the controller isn't active if !_controller.get_is_active(): return @@ -61,7 +62,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): var crouching := _controller.is_button_pressed(crouch_button) != 0 if crouching == _crouching: return - + # Update crouching state _crouching = crouching if crouching: @@ -70,7 +71,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): player_body.override_player_height(self) -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Check the controller node var test_controller = get_parent() diff --git a/addons/godot-xr-tools/functions/movement_crouch.tscn b/addons/godot-xr-tools/functions/movement_crouch.tscn new file mode 100644 index 00000000..b039295e --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_crouch.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_crouch.gd" type="Script" id=1] + +[node name="MovementCrouch" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Direct_movement.gd b/addons/godot-xr-tools/functions/movement_direct.gd similarity index 77% rename from addons/godot-xr-tools/functions/Function_Direct_movement.gd rename to addons/godot-xr-tools/functions/movement_direct.gd index f32c4ada..aaa3887e 100644 --- a/addons/godot-xr-tools/functions/Function_Direct_movement.gd +++ b/addons/godot-xr-tools/functions/movement_direct.gd @@ -1,14 +1,13 @@ tool -class_name Function_DirectMovement -extends MovementProvider +class_name XRToolsDirectMovement +extends XRToolsMovementProvider ## ## Movement Provider for Direct Movement ## ## @desc: -## This script works with the Function_Direct_movement asset to provide -## direct movement for the player. This script works with the PlayerBody -## attached to the players ARVROrigin. +## This script provides direct movement for the player. This script works +## with the PlayerBody attached to the players ARVROrigin. ## ## The following types of direct movement are supported: ## - Slewing @@ -34,7 +33,7 @@ onready var _controller : ARVRController = get_parent() # Perform jump movement -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the controller isn't active if !_controller.get_is_active(): return @@ -52,7 +51,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): player_body.ground_control_velocity *= max_speed / length -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Check the controller node var test_controller = get_parent() diff --git a/addons/godot-xr-tools/functions/movement_direct.tscn b/addons/godot-xr-tools/functions/movement_direct.tscn new file mode 100644 index 00000000..209ccc16 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_direct.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.gd" type="Script" id=1] + +[node name="MovementDirect" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) +enabled = null +order = null +max_speed = null +strafe = null diff --git a/addons/godot-xr-tools/functions/Function_Flight_movement.gd b/addons/godot-xr-tools/functions/movement_flight.gd similarity index 96% rename from addons/godot-xr-tools/functions/Function_Flight_movement.gd rename to addons/godot-xr-tools/functions/movement_flight.gd index 0814c98b..5e31fedd 100644 --- a/addons/godot-xr-tools/functions/Function_Flight_movement.gd +++ b/addons/godot-xr-tools/functions/movement_flight.gd @@ -1,6 +1,6 @@ tool -class_name Function_FlightMovement -extends MovementProvider +class_name XRToolsFlightMovement +extends XRToolsMovementProvider ## @@ -141,7 +141,7 @@ func _ready(): # Process physics movement for -func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Disable flying if requested, or if no controller if disabled or !enabled or !_controller.get_is_active(): set_flying(false) @@ -226,7 +226,7 @@ func set_flying(active: bool) -> void: emit_signal("flight_finished") -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Call base class return ._get_configuration_warning() diff --git a/addons/godot-xr-tools/functions/movement_flight.tscn b/addons/godot-xr-tools/functions/movement_flight.tscn new file mode 100644 index 00000000..de534761 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_flight.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_flight.gd" type="Script" id=1] + +[node name="MovementFlight" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Glide_movement.gd b/addons/godot-xr-tools/functions/movement_glide.gd similarity index 91% rename from addons/godot-xr-tools/functions/Function_Glide_movement.gd rename to addons/godot-xr-tools/functions/movement_glide.gd index 4812d8ca..8e902849 100644 --- a/addons/godot-xr-tools/functions/Function_Glide_movement.gd +++ b/addons/godot-xr-tools/functions/movement_glide.gd @@ -1,14 +1,13 @@ tool -class_name Function_Glide -extends MovementProvider +class_name XRToolsMovementGlide +extends XRToolsMovementProvider ## ## Movement Provider for Gliding ## ## @desc: -## This script works with the Function_Glide_movement asset to provide glide -## mechanics for the player. This script works with the PlayerBody attached -## to the players ARVROrigin. +## This script provides glide mechanics for the player. This script works +## with the PlayerBody attached to the players ARVROrigin. ## ## The player enables flying by moving the controllers apart further than ## 'glide_detect_distance'. @@ -59,7 +58,7 @@ onready var _left_controller := ARVRHelpers.get_left_controller(self) onready var _right_controller := ARVRHelpers.get_right_controller(self) -func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Skip if disabled or either controller is off if disabled or !enabled or !_left_controller.get_is_active() or !_right_controller.get_is_active(): _set_gliding(false) @@ -115,7 +114,7 @@ func _set_gliding(active: bool) -> void: else: emit_signal("player_glide_end") -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Verify the left controller var test_left_controller_node = ARVRHelpers.get_left_controller(self) diff --git a/addons/godot-xr-tools/functions/movement_glide.tscn b/addons/godot-xr-tools/functions/movement_glide.tscn new file mode 100644 index 00000000..372ff37a --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_glide.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_glide.gd" type="Script" id=1] + +[node name="MovementGlide" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Grapple_movement.gd b/addons/godot-xr-tools/functions/movement_grapple.gd similarity index 93% rename from addons/godot-xr-tools/functions/Function_Grapple_movement.gd rename to addons/godot-xr-tools/functions/movement_grapple.gd index 04867368..3b9c694b 100644 --- a/addons/godot-xr-tools/functions/Function_Grapple_movement.gd +++ b/addons/godot-xr-tools/functions/movement_grapple.gd @@ -1,20 +1,21 @@ tool -class_name Function_Grapple -extends MovementProvider +class_name XRToolsMovementGrapple +extends XRToolsMovementProvider ## ## Movement Provider for Grapple Movement ## ## @desc: -## This script provide simple grapple based movement - "bat hook" style where the player moves -## directly to the grapple location. This script works with the PlayerBody attached to the -## players ARVROrigin. +## This script provide simple grapple based movement - "bat hook" style +## where the player moves directly to the grapple location. This script +## works with the PlayerBody attached to the players ARVROrigin. ## ## The player may have multiple movement nodes attached to different ## controllers to provide different types of movement. ## -## The player can have a grapple node attached to each hand and the movement should not break. +## The player can have a grapple node attached to each hand and the +## movement should not break. ## @@ -96,7 +97,7 @@ onready var _controller : ARVRController = get_parent() # Get Raycast node onready var _grapple_raycast : RayCast = $Grapple_RayCast -# Get Grapple Target Node +# Get Grapple Target Node onready var _grapple_target : Spatial = $Grapple_Target @@ -146,7 +147,7 @@ func _process(_delta: float): # Perform grapple movement -func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Disable if requested if disabled or !enabled or !_controller.get_is_active(): _set_grappling(false) @@ -177,7 +178,7 @@ func physics_movement(delta: float, player_body: PlayerBody, disabled: bool): var hook_length := hook_vector.length() var hook_direction := hook_vector / hook_length - # Apply gravity + # Apply gravity player_body.velocity += Vector3.UP * player_body.gravity * delta # Select the grapple speed @@ -221,7 +222,7 @@ func _set_grappling(var active: bool) -> void: emit_signal("grapple_finished") -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Check the controller node var test_controller = get_parent() diff --git a/addons/godot-xr-tools/functions/Function_Grapple_movement.tscn b/addons/godot-xr-tools/functions/movement_grapple.tscn similarity index 81% rename from addons/godot-xr-tools/functions/Function_Grapple_movement.tscn rename to addons/godot-xr-tools/functions/movement_grapple.tscn index 3fb75370..04ada5cc 100644 --- a/addons/godot-xr-tools/functions/Function_Grapple_movement.tscn +++ b/addons/godot-xr-tools/functions/movement_grapple.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Grapple_movement.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_grapple.gd" type="Script" id=1] [ext_resource path="res://addons/godot-xr-tools/materials/pointer.tres" type="Material" id=2] [sub_resource type="CubeMesh" id=1] @@ -8,7 +8,7 @@ resource_local_to_scene = true size = Vector3( 0.05, 0.05, 0.05 ) subdivide_depth = 20 -[node name="Function_Grapple_movement" type="Spatial" groups=["movement_providers"]] +[node name="MovementGrapple" type="Spatial" groups=["movement_providers"]] script = ExtResource( 1 ) [node name="Grapple_RayCast" type="RayCast" parent="."] diff --git a/addons/godot-xr-tools/functions/Function_Jump_movement.gd b/addons/godot-xr-tools/functions/movement_jump.gd similarity index 71% rename from addons/godot-xr-tools/functions/Function_Jump_movement.gd rename to addons/godot-xr-tools/functions/movement_jump.gd index 76bbd061..6f45d5be 100644 --- a/addons/godot-xr-tools/functions/Function_Jump_movement.gd +++ b/addons/godot-xr-tools/functions/movement_jump.gd @@ -1,17 +1,16 @@ tool -class_name Function_Jump -extends MovementProvider +class_name XRToolsMovementJump +extends XRToolsMovementProvider ## ## Movement Provider for Jumping ## ## @desc: -## This script works with the Function_Jump_movement asset to provide -## jumping mechanics for the player. This script works with the PlayerBody -## attached to the players ARVROrigin. +## This script provides jumping mechanics for the player. This script works +## with the PlayerBody attached to the players ARVROrigin. ## -## The player enables jumping by attaching a Function_Jump_movement as a -## child of the appropriate ARVRController, then configuring the jump button +## The player enables jumping by attaching an XRToolsMovementJump as a +## child of the appropriate ARVRController, then configuring the jump button ## and jump velocity. ## @@ -44,7 +43,7 @@ export (Buttons) var jump_button_id = Buttons.VR_TRIGGER onready var _controller: ARVRController = get_parent() # Perform jump movement -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the jump controller isn't active if !_controller.get_is_active(): return @@ -53,7 +52,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): if _controller.is_button_pressed(jump_button_id): player_body.request_jump() -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Check the controller node var test_controller = get_parent() diff --git a/addons/godot-xr-tools/functions/movement_jump.tscn b/addons/godot-xr-tools/functions/movement_jump.tscn new file mode 100644 index 00000000..f663e4e7 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_jump.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_jump.gd" type="Script" id=1] + +[node name="MovementJump" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) +jump_button_id = null diff --git a/addons/godot-xr-tools/functions/Function_JumpDetect_movement.gd b/addons/godot-xr-tools/functions/movement_jump_detect.gd similarity index 93% rename from addons/godot-xr-tools/functions/Function_JumpDetect_movement.gd rename to addons/godot-xr-tools/functions/movement_jump_detect.gd index deeac9bd..e14a96f9 100644 --- a/addons/godot-xr-tools/functions/Function_JumpDetect_movement.gd +++ b/addons/godot-xr-tools/functions/movement_jump_detect.gd @@ -1,6 +1,6 @@ tool -class_name Function_JumpDetect -extends MovementProvider +class_name XRToolsMovementJumpDetect +extends XRToolsMovementProvider ## @@ -18,7 +18,7 @@ extends MovementProvider ## The player arms jumping is detected by putting both controllers instantaneous ## Y velocity (in the tracking space) into a sliding-window averager. If both ## average Y velocities exceed a threshold parameter then the player has -## jumped. +## jumped. ## @@ -41,6 +41,23 @@ export var arms_jump_enable := false export var arms_jump_threshold := 5.0 +# Node Positions +var _camera_position := 0.0 +var _controller_left_position := 0.0 +var _controller_right_position := 0.0 + +# Node Velocities +var _camera_velocity := SlidingAverage.new(5) +var _controller_left_velocity := SlidingAverage.new(5) +var _controller_right_velocity := SlidingAverage.new(5) + +# Node references +onready var _origin_node := ARVRHelpers.get_arvr_origin(self) +onready var _camera_node := ARVRHelpers.get_arvr_camera(self) +onready var _controller_left_node := ARVRHelpers.get_left_controller(self) +onready var _controller_right_node := ARVRHelpers.get_right_controller(self) + + # Sliding Average class class SlidingAverage: # Sliding window size @@ -76,36 +93,19 @@ class SlidingAverage: return _sum / _size -# Node Positions -var _camera_position := 0.0 -var _controller_left_position := 0.0 -var _controller_right_position := 0.0 - -# Node Velocities -var _camera_velocity := SlidingAverage.new(5) -var _controller_left_velocity := SlidingAverage.new(5) -var _controller_right_velocity := SlidingAverage.new(5) - -# Node references -onready var _origin_node := ARVRHelpers.get_arvr_origin(self) -onready var _camera_node := ARVRHelpers.get_arvr_camera(self) -onready var _controller_left_node := ARVRHelpers.get_left_controller(self) -onready var _controller_right_node := ARVRHelpers.get_right_controller(self) - - # Perform jump detection -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Handle detecting body jump if body_jump_enable: _detect_body_jump(delta, player_body) - + # Handle detecting arms jump if arms_jump_enable: _detect_arms_jump(delta, player_body) # Detect the player jumping with their body (using the headset camera) -func _detect_body_jump(delta: float, player_body: PlayerBody) -> void: +func _detect_body_jump(delta: float, player_body: XRToolsPlayerBody) -> void: # Get the camera instantaneous velocity var new_camera_pos := _camera_node.transform.origin.y var camera_vel := (new_camera_pos - _camera_position) / delta @@ -130,7 +130,7 @@ func _detect_body_jump(delta: float, player_body: PlayerBody) -> void: # Detect the player jumping with their arms (using the controllers) -func _detect_arms_jump(delta: float, player_body: PlayerBody) -> void: +func _detect_arms_jump(delta: float, player_body: XRToolsPlayerBody) -> void: # Skip if either of the controllers is disabled if !_controller_left_node.get_is_active() or !_controller_right_node.get_is_active(): return @@ -150,7 +150,7 @@ func _detect_arms_jump(delta: float, player_body: PlayerBody) -> void: # Correct for ARVR world-scale (convert to player units) controller_left_vel /= ARVRServer.world_scale controller_right_vel /= ARVRServer.world_scale - + # Clamp the controller instantaneous velocity to +/- 2x the jump threshold controller_left_vel = clamp(controller_left_vel, -2.0 * arms_jump_threshold, 2.0 * arms_jump_threshold) controller_right_vel = clamp(controller_right_vel, -2.0 * arms_jump_threshold, 2.0 * arms_jump_threshold) diff --git a/addons/godot-xr-tools/functions/movement_jump_detect.tscn b/addons/godot-xr-tools/functions/movement_jump_detect.tscn new file mode 100644 index 00000000..5aad3693 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_jump_detect.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_jump_detect.gd" type="Script" id=1] + +[node name="MovementJumpDetect" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) +arms_jump_enable = true diff --git a/addons/godot-xr-tools/functions/MovementProvider.gd b/addons/godot-xr-tools/functions/movement_provider.gd similarity index 80% rename from addons/godot-xr-tools/functions/MovementProvider.gd rename to addons/godot-xr-tools/functions/movement_provider.gd index e0dfdd9c..e5c9bbd3 100644 --- a/addons/godot-xr-tools/functions/MovementProvider.gd +++ b/addons/godot-xr-tools/functions/movement_provider.gd @@ -1,16 +1,16 @@ tool -class_name MovementProvider, "res://addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg" +class_name XRToolsMovementProvider, "res://addons/godot-xr-tools/editor/icons/movement_provider.svg" extends Node ## ## Movement Provider base class ## ## @desc: -## This MovementProvider class is the base class of all movement providers. +## This movement provider class is the base class of all movement providers. ## Movement providers are invoked by the PlayerBody object in order to apply ## motion to the player ## -## MovementProvider implementations should: +## Movement provider implementations should: ## - Export an 'order' integer to control order of processing ## - Override the physics_movement method to impelment motion ## @@ -24,7 +24,7 @@ var is_active := false # Get our player body, this should be a node on our ARVROrigin node. -func get_player_body() -> PlayerBody: +func get_player_body() -> XRToolsPlayerBody: # get our origin node var arvr_origin := ARVRHelpers.get_arvr_origin(self) if !arvr_origin: @@ -35,7 +35,7 @@ func get_player_body() -> PlayerBody: return null # get our player node - var player_body := arvr_origin.get_node("PlayerBody") as PlayerBody + var player_body := arvr_origin.get_node("PlayerBody") as XRToolsPlayerBody if player_body: return player_body @@ -52,7 +52,7 @@ func _create_player_body_node(): var player_body = get_player_body() if !player_body: # create our player body node and add it into our tree - player_body = preload("res://addons/godot-xr-tools/assets/PlayerBody.tscn") + player_body = preload("res://addons/godot-xr-tools/assets/player_body.tscn") player_body = player_body.instance() player_body.set_name("PlayerBody") arvr_origin.add_child(player_body) @@ -69,10 +69,10 @@ func _ready(): call_deferred("_create_player_body_node") # Override this function to apply motion to the PlayerBody -func physics_movement(_delta: float, _player_body: PlayerBody, _disabled: bool): +func physics_movement(_delta: float, _player_body: XRToolsPlayerBody, _disabled: bool): pass -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Verify we're within the tree of an ARVROrigin node var arvr_origin = ARVRHelpers.get_arvr_origin(self) diff --git a/addons/godot-xr-tools/functions/Function_Turn_movement.gd b/addons/godot-xr-tools/functions/movement_turn.gd similarity index 87% rename from addons/godot-xr-tools/functions/Function_Turn_movement.gd rename to addons/godot-xr-tools/functions/movement_turn.gd index 590c30b9..b1b62dfe 100644 --- a/addons/godot-xr-tools/functions/Function_Turn_movement.gd +++ b/addons/godot-xr-tools/functions/movement_turn.gd @@ -1,6 +1,6 @@ tool -class_name Function_TurnMovement -extends MovementProvider +class_name XRToolsMovementTurn +extends XRToolsMovementProvider ## ## Movement Provider for Turning @@ -40,7 +40,7 @@ onready var _controller : ARVRController = get_parent() # Perform jump movement -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the controller isn't active if !_controller.get_is_active(): return @@ -68,7 +68,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): # Rotate the origin node around the camera -func _rotate_player(player_body: PlayerBody, angle: float): +func _rotate_player(player_body: XRToolsPlayerBody, angle: float): var t1 := Transform() var t2 := Transform() var rot := Transform() @@ -79,7 +79,7 @@ func _rotate_player(player_body: PlayerBody, angle: float): player_body.origin_node.transform = (player_body.origin_node.transform * t2 * rot * t1).orthonormalized() -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Check the controller node var test_controller = get_parent() diff --git a/addons/godot-xr-tools/functions/movement_turn.tscn b/addons/godot-xr-tools/functions/movement_turn.tscn new file mode 100644 index 00000000..2933c621 --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_turn.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.gd" type="Script" id=1] + +[node name="MovementTurn" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/functions/Function_Wind_movement.gd b/addons/godot-xr-tools/functions/movement_wind.gd similarity index 89% rename from addons/godot-xr-tools/functions/Function_Wind_movement.gd rename to addons/godot-xr-tools/functions/movement_wind.gd index 8c2e78e9..8a37b820 100644 --- a/addons/godot-xr-tools/functions/Function_Wind_movement.gd +++ b/addons/godot-xr-tools/functions/movement_wind.gd @@ -1,6 +1,6 @@ tool -class_name Function_WindMovement -extends MovementProvider +class_name XRToolsMovementWind +extends XRToolsMovementProvider ## Signal invoked when changing active wind areas @@ -24,7 +24,7 @@ var _sense_area: Area var _in_wind_areas := Array() # Currently active wind area -var _active_wind_area: WindArea = null +var _active_wind_area: XRToolsWindArea = null # Called when the node enters the scene tree for the first time. @@ -32,16 +32,16 @@ func _ready(): # Skip if running in the editor if Engine.editor_hint: return - + # Skip if we don't have a camera var camera := ARVRHelpers.get_arvr_camera(self) if !camera: return - + # Construct the sphere shape var sphere_shape := SphereShape.new() sphere_shape.radius = 0.3 - + # Construct the collision shape var collision_shape := CollisionShape.new() collision_shape.set_name("WindSensorShape") @@ -69,7 +69,7 @@ func set_collision_mask(new_mask: int) -> void: func _on_area_entered(area: Area): # Skip if not wind area - var wind_area = area as WindArea + var wind_area = area as XRToolsWindArea if !wind_area: return @@ -84,7 +84,7 @@ func _on_area_entered(area: Area): func _on_area_exited(area: Area): # Erase from the wind area _in_wind_areas.erase(area) - + # If we didn't leave the active wind area then we're done if area != _active_wind_area: return @@ -100,7 +100,7 @@ func _on_area_exited(area: Area): # Perform jump movement -func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): +func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if no active wind area if !_active_wind_area: return @@ -114,7 +114,7 @@ func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool): player_body.velocity = lerp(player_body.velocity, wind_velocity, drag_factor) -# This method verifies the MovementProvider has a valid configuration. +# This method verifies the movement provider has a valid configuration. func _get_configuration_warning(): # Call base class return ._get_configuration_warning() diff --git a/addons/godot-xr-tools/functions/movement_wind.tscn b/addons/godot-xr-tools/functions/movement_wind.tscn new file mode 100644 index 00000000..3a59c41e --- /dev/null +++ b/addons/godot-xr-tools/functions/movement_wind.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/functions/movement_wind.gd" type="Script" id=1] + +[node name="MovementWind" type="Node" groups=["movement_providers"]] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd b/addons/godot-xr-tools/interactables/interactable_area_button.gd similarity index 98% rename from addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd rename to addons/godot-xr-tools/interactables/interactable_area_button.gd index 376a1af7..d4759aea 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd +++ b/addons/godot-xr-tools/interactables/interactable_area_button.gd @@ -1,5 +1,5 @@ tool -class_name XRTInteractableAreaButton +class_name XRToolsInteractableAreaButton extends Area @@ -10,7 +10,7 @@ extends Area ## The interactable area button detects objects and areas intering its ## area, and moves an associated button object using a tween to animate ## the movement. -## +## ## Button pressed event @@ -53,7 +53,7 @@ func _ready(): _tween = Tween.new() _tween.set_name("Tween") add_child(_tween) - + # Connect area signals if connect("area_entered", self, "_on_button_entered"): push_error("Unable to connect button area signal") diff --git a/addons/godot-xr-tools/interactables/interactable_area_button.tscn b/addons/godot-xr-tools/interactables/interactable_area_button.tscn new file mode 100644 index 00000000..db8a2959 --- /dev/null +++ b/addons/godot-xr-tools/interactables/interactable_area_button.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_area_button.gd" type="Script" id=1] + +[node name="InteractableAreaButton" type="Area"] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_handle.gd b/addons/godot-xr-tools/interactables/interactable_handle.gd similarity index 97% rename from addons/godot-xr-tools/interactables/xrt_interactable_handle.gd rename to addons/godot-xr-tools/interactables/interactable_handle.gd index 7584de9a..1625a092 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_handle.gd +++ b/addons/godot-xr-tools/interactables/interactable_handle.gd @@ -1,5 +1,5 @@ tool -class_name XRTInteractableHandle +class_name XRToolsInteractableHandle extends XRToolsPickable @@ -7,18 +7,18 @@ extends XRToolsPickable ## Interactable Handle script ## ## @desc: -## The interactable handle is a (usually invisible) object that can be +## The interactable handle is a (usually invisible) object that can be ## grabbed by the player and is used to manipulate interactable objects. ## ## The interactible handle has an origin position of its parent. In order ## to position interactible handles on the interactible object, the handle -## should be placed under a parent handle-origin Spatial node, and the +## should be placed under a parent handle-origin Spatial node, and the ## origin nodes position set as desired. ## ## When the handle is released, it snaps back to its parent origin. If the ## handle is pulled further than its snap distance, then the handle is ## automatically released. -## +## ## Distance from the handle origin to auto-snap the grab diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_handle.tscn b/addons/godot-xr-tools/interactables/interactable_handle.tscn similarity index 66% rename from addons/godot-xr-tools/interactables/xrt_interactable_handle.tscn rename to addons/godot-xr-tools/interactables/interactable_handle.tscn index bc154b70..6f1741fc 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_handle.tscn +++ b/addons/godot-xr-tools/interactables/interactable_handle.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=1] [node name="InteractableHandle" type="RigidBody"] collision_layer = 262144 diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_handle_driven.gd b/addons/godot-xr-tools/interactables/interactable_handle_driven.gd similarity index 88% rename from addons/godot-xr-tools/interactables/xrt_interactable_handle_driven.gd rename to addons/godot-xr-tools/interactables/interactable_handle_driven.gd index 88096f46..a084ef0a 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_handle_driven.gd +++ b/addons/godot-xr-tools/interactables/interactable_handle_driven.gd @@ -1,4 +1,4 @@ -class_name XRTInteractableHandleDriven +class_name XRToolsInteractableHandleDriven extends Spatial @@ -12,7 +12,7 @@ extends Spatial ## ## When one or more handles are grabbed, the _process function is enabled ## to process the handle-driven movement. -## +## ## Signal called when this interactable is grabbed @@ -36,7 +36,7 @@ func _ready(): # Called when a handle is picked up -func _on_handle_picked_up(var handle: XRTInteractableHandle) -> void: +func _on_handle_picked_up(var handle: XRToolsInteractableHandle) -> void: # Append to the list of grabbed handles grabbed_handles.append(handle) @@ -50,7 +50,7 @@ func _on_handle_picked_up(var handle: XRTInteractableHandle) -> void: # Called when a handle is dropped -func _on_handle_dropped(var handle: XRTInteractableHandle) -> void: +func _on_handle_dropped(var handle: XRToolsInteractableHandle) -> void: # Remove from the list of grabbed handles grabbed_handles.erase(handle) @@ -66,7 +66,7 @@ func _on_handle_dropped(var handle: XRTInteractableHandle) -> void: # Recursive function to hook picked_up and dropped signals in all child handles func _hook_child_handles(var node: Node) -> void: # If this node is a handle then hook its handle signals - var handle := node as XRTInteractableHandle + var handle := node as XRToolsInteractableHandle if handle: if handle.connect("picked_up", self, "_on_handle_picked_up"): push_error("Unable to connect handle signal") diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd b/addons/godot-xr-tools/interactables/interactable_hinge.gd similarity index 96% rename from addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd rename to addons/godot-xr-tools/interactables/interactable_hinge.gd index cd42add8..cd75581b 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd +++ b/addons/godot-xr-tools/interactables/interactable_hinge.gd @@ -1,5 +1,5 @@ -class_name XRTInteractableHinge -extends XRTInteractableHandleDriven +class_name XRToolsInteractableHinge +extends XRToolsInteractableHandleDriven ## @@ -10,12 +10,12 @@ extends XRTInteractableHandleDriven ## player through interactable handles. ## ## The hinge rotates itelf around its local X axis, and so should be -## placed as a child of a spatial node to translate and rotate as +## placed as a child of a spatial node to translate and rotate as ## appropriate. ## ## The interactable hinge is not a rigid body, and as such will not react ## to any collisions. -## +## ## Signal for hinge moved signal hinge_moved(angle) @@ -66,8 +66,8 @@ func _process(var _delta: float) -> void: # Get the total handle angular offsets var offset_sum := 0.0 for item in grabbed_handles: - var handle := item as XRTInteractableHandle - var to_handle: Vector3 = global_transform.xform_inv(handle.global_transform.origin) + var handle := item as XRToolsInteractableHandle + var to_handle: Vector3 = global_transform.xform_inv(handle.global_transform.origin) var to_handle_origin: Vector3 = global_transform.xform_inv(handle.handle_origin.global_transform.origin) to_handle.x = 0.0 to_handle_origin.x = 0.0 diff --git a/addons/godot-xr-tools/interactables/interactable_hinge.tscn b/addons/godot-xr-tools/interactables/interactable_hinge.tscn new file mode 100644 index 00000000..11e5ed82 --- /dev/null +++ b/addons/godot-xr-tools/interactables/interactable_hinge.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_hinge.gd" type="Script" id=1] + +[node name="InteractableHinge" type="Spatial"] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd b/addons/godot-xr-tools/interactables/interactable_joystick.gd similarity index 97% rename from addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd rename to addons/godot-xr-tools/interactables/interactable_joystick.gd index aab70b57..bbda36e7 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd +++ b/addons/godot-xr-tools/interactables/interactable_joystick.gd @@ -1,5 +1,5 @@ -class_name XRTInteractableJoystick -extends XRTInteractableHandleDriven +class_name XRToolsInteractableJoystick +extends XRToolsInteractableHandleDriven ## @@ -10,12 +10,16 @@ extends XRTInteractableHandleDriven ## player through interactable handles. ## ## The joystick rotates itelf around its local X/Y axes, and so should be -## placed as a child of a spatial node to translate and rotate as +## placed as a child of a spatial node to translate and rotate as ## appropriate. ## ## The interactable joystick is not a rigid body, and as such will not react ## to any collisions. -## +## + + +## Signal for hinge moved +signal joystick_moved(x_angle, y_angle) ## Constant for flattening a vector horizontally (X/Z only) @@ -25,9 +29,6 @@ const VECTOR_XZ := Vector3(1.0, 0.0, 1.0) const VECTOR_YZ := Vector3(0.0, 1.0, 1.0) -## Signal for hinge moved -signal joystick_moved(x_angle, y_angle) - ## Joystick X minimum limit export var joystick_x_limit_min := -45.0 setget _set_joystick_x_limit_min @@ -79,7 +80,7 @@ onready var _default_y_position_rad := deg2rad(default_y_position) func _ready(): # Set the initial position to match the initial joystick position value transform = Transform( - Basis(Vector3(_joystick_y_position_rad, _joystick_x_position_rad, 0)), + Basis(Vector3(_joystick_y_position_rad, _joystick_x_position_rad, 0)), Vector3.ZERO) # Connect signals @@ -93,8 +94,8 @@ func _process(var _delta: float) -> void: var offset_x_sum := 0.0 var offset_y_sum := 0.0 for item in grabbed_handles: - var handle := item as XRTInteractableHandle - var to_handle: Vector3 = global_transform.xform_inv(handle.global_transform.origin) + var handle := item as XRToolsInteractableHandle + var to_handle: Vector3 = global_transform.xform_inv(handle.global_transform.origin) var to_handle_origin: Vector3 = global_transform.xform_inv(handle.handle_origin.global_transform.origin) var to_handle_x := to_handle * VECTOR_XZ diff --git a/addons/godot-xr-tools/interactables/interactable_joystick.tscn b/addons/godot-xr-tools/interactables/interactable_joystick.tscn new file mode 100644 index 00000000..1dcd9a49 --- /dev/null +++ b/addons/godot-xr-tools/interactables/interactable_joystick.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_joystick.gd" type="Script" id=1] + +[node name="InteractableJoystick" type="Spatial"] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_slider.gd b/addons/godot-xr-tools/interactables/interactable_slider.gd similarity index 94% rename from addons/godot-xr-tools/interactables/xrt_interactable_slider.gd rename to addons/godot-xr-tools/interactables/interactable_slider.gd index b7158b18..e56fefc9 100644 --- a/addons/godot-xr-tools/interactables/xrt_interactable_slider.gd +++ b/addons/godot-xr-tools/interactables/interactable_slider.gd @@ -1,5 +1,5 @@ -class_name XRTInteractableSlider -extends XRTInteractableHandleDriven +class_name XRToolsInteractableSlider +extends XRToolsInteractableHandleDriven ## @@ -10,12 +10,12 @@ extends XRTInteractableHandleDriven ## player through interactable handles. ## ## The slider translates itelf along its local X axis, and so should be -## placed as a child of a spatial node to translate and rotate as +## placed as a child of a spatial node to translate and rotate as ## appropriate. ## ## The interactable slider is not a rigid body, and as such will not react ## to any collisions. -## +## ## Signal for slider moved @@ -45,7 +45,7 @@ export var default_on_release := false func _ready() -> void: # Set the initial position to match the initial slider position value transform = Transform( - Basis.IDENTITY, + Basis.IDENTITY, Vector3(slider_position, 0.0, 0.0) ) @@ -59,12 +59,12 @@ func _process(var _delta: float) -> void: # Get the total handle offsets var offset_sum := Vector3.ZERO for item in grabbed_handles: - var handle := item as XRTInteractableHandle + 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 = global_transform.basis.xform_inv(offset_sum) - + # Get the average displacement in the X axis var offset := offset_sum.x / grabbed_handles.size() diff --git a/addons/godot-xr-tools/interactables/interactable_slider.tscn b/addons/godot-xr-tools/interactables/interactable_slider.tscn new file mode 100644 index 00000000..e9cc7679 --- /dev/null +++ b/addons/godot-xr-tools/interactables/interactable_slider.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_slider.gd" type="Script" id=1] + +[node name="InteractableSlider" type="Spatial"] +script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_area_button.tscn b/addons/godot-xr-tools/interactables/xrt_interactable_area_button.tscn deleted file mode 100644 index 1942b4ac..00000000 --- a/addons/godot-xr-tools/interactables/xrt_interactable_area_button.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd" type="Script" id=1] - -[node name="InteractableAreaButton" type="Area"] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_hinge.tscn b/addons/godot-xr-tools/interactables/xrt_interactable_hinge.tscn deleted file mode 100644 index cb5e430b..00000000 --- a/addons/godot-xr-tools/interactables/xrt_interactable_hinge.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" type="Script" id=1] - -[node name="InteractableHinge" type="Spatial"] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_joystick.tscn b/addons/godot-xr-tools/interactables/xrt_interactable_joystick.tscn deleted file mode 100644 index 382b5e6b..00000000 --- a/addons/godot-xr-tools/interactables/xrt_interactable_joystick.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd" type="Script" id=1] - -[node name="InteractableJoystick" type="Spatial"] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/interactables/xrt_interactable_slider.tscn b/addons/godot-xr-tools/interactables/xrt_interactable_slider.tscn deleted file mode 100644 index 0f67a1b2..00000000 --- a/addons/godot-xr-tools/interactables/xrt_interactable_slider.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_slider.gd" type="Script" id=1] - -[node name="InteractableSlider" type="Spatial"] -script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/materials/highlight.tres b/addons/godot-xr-tools/materials/highlight.tres index d694cbe1..8f4a7114 100644 --- a/addons/godot-xr-tools/materials/highlight.tres +++ b/addons/godot-xr-tools/materials/highlight.tres @@ -17,7 +17,7 @@ operator = 2 [sub_resource type="VisualShader" id=6] code = "shader_type spatial; -render_mode specular_schlick_ggx, async_visible; +render_mode specular_schlick_ggx; uniform vec4 Color : hint_color; diff --git a/addons/godot-xr-tools/misc/ARVR_Helpers.gd b/addons/godot-xr-tools/misc/arvr_helpers.gd similarity index 99% rename from addons/godot-xr-tools/misc/ARVR_Helpers.gd rename to addons/godot-xr-tools/misc/arvr_helpers.gd index 7b99f21b..aef77623 100644 --- a/addons/godot-xr-tools/misc/ARVR_Helpers.gd +++ b/addons/godot-xr-tools/misc/arvr_helpers.gd @@ -37,7 +37,7 @@ static func get_arvr_origin(node: Node, path: NodePath = NodePath("")) -> ARVROr ## Find the ARVR Camera from a player node and an optional path static func get_arvr_camera(node: Node, path: NodePath = NodePath("")) -> ARVRCamera: var camera: ARVRCamera - + # Try using the node path first if path: camera = node.get_node(path) as ARVRCamera @@ -59,7 +59,7 @@ static func get_arvr_camera(node: Node, path: NodePath = NodePath("")) -> ARVRCa camera = child as ARVRCamera if camera: return camera - + # Could not find camera return null @@ -74,7 +74,7 @@ static func get_right_controller(node: Node, path: NodePath = NodePath("")) -> A ## Find a controller given some search parameters static func _get_controller(var node: Node, var default_name: String, var id: int, var path: NodePath) -> ARVRController: var controller: ARVRController - + # Try using the node path first if path: controller = node.get_node(path) as ARVRController diff --git a/addons/godot-xr-tools/misc/hold_button.gd b/addons/godot-xr-tools/misc/hold_button.gd index e86d320f..a6e181f6 100644 --- a/addons/godot-xr-tools/misc/hold_button.gd +++ b/addons/godot-xr-tools/misc/hold_button.gd @@ -1,24 +1,12 @@ tool +class_name XRToolsHoldButton extends Spatial -class_name XRToolsHoldButton signal pressed -# Enable our button -export var enabled: bool = false setget set_enabled - -func set_enabled(p_enabled): - enabled = p_enabled - _update_enabled() - -func _update_enabled(): - if is_inside_tree() and !Engine.is_editor_hint(): - _set_time_held(0.0) - set_process(enabled) # Button - enum Buttons { VR_BUTTON_BY = 1, VR_GRIP = 2, @@ -37,82 +25,103 @@ enum Buttons { VR_TRIGGER = 15 } + +# Enable our button +export var enabled: bool = false setget set_enabled + export (Buttons) var activate_button: int = Buttons.VR_TRIGGER # Countdown - export var hold_time: float = 2.0 -var time_held = 0.0 -func _set_time_held(p_time_held): - time_held = p_time_held - if material: - $Visualise.visible = time_held > 0.0 - material.set_shader_param("value", time_held/hold_time) +# Color our our visualisation +export var color: Color = Color(1.0, 1.0, 1.0, 1.0) setget set_color # Size - export var size: Vector2 = Vector2(1.0, 1.0) setget set_size -func set_size(p_size): - size = p_size - _update_size() -func _update_size(): - if material: # Note, material won't be set until after we setup our scene - var mesh : QuadMesh = $Visualise.mesh - if mesh.size != size: - mesh.size = size - - # updating the size will unset our material, so reset it - $Visualise.set_surface_material(0, material) - -# Color our our visualisation -export var color: Color = Color(1.0, 1.0, 1.0, 1.0) setget set_color +var time_held = 0.0 var material : ShaderMaterial -func set_color(p_color): - color = p_color - _update_color() - -func _update_color(): - if material: - material.set_shader_param("albedo", color) # Called when the node enters the scene tree for the first time. func _ready(): material = $Visualise.get_surface_material(0) - + if !Engine.is_editor_hint(): _set_time_held(0.0) - + _update_size() _update_color() _update_enabled() + func _process(delta): if Engine.is_editor_hint(): return - + var button_pressed = false - + # we check all trackers for i in ARVRServer.get_tracker_count(): var tracker : ARVRPositionalTracker = ARVRServer.get_tracker(i) if tracker.get_hand() != 0: var joy_id = tracker.get_joy_id() - + if Input.is_joy_button_pressed(joy_id, activate_button): button_pressed = true - + if button_pressed: _set_time_held(time_held + delta) if time_held > hold_time: # done, disable this set_enabled(false) - + emit_signal("pressed") else: _set_time_held(max(0.0, time_held - delta)) - + + +func set_enabled(p_enabled: bool): + enabled = p_enabled + _update_enabled() + + +func _update_enabled(): + if is_inside_tree() and !Engine.is_editor_hint(): + _set_time_held(0.0) + set_process(enabled) + + +func _set_time_held(p_time_held): + time_held = p_time_held + if material: + $Visualise.visible = time_held > 0.0 + material.set_shader_param("value", time_held/hold_time) + + +func set_size(p_size: Vector2): + size = p_size + _update_size() + + +func _update_size(): + if material: # Note, material won't be set until after we setup our scene + var mesh : QuadMesh = $Visualise.mesh + if mesh.size != size: + mesh.size = size + + # updating the size will unset our material, so reset it + $Visualise.set_surface_material(0, material) + + +func set_color(p_color: Color): + color = p_color + _update_color() + + +func _update_color(): + if material: + material.set_shader_param("albedo", color) diff --git a/addons/godot-xr-tools/misc/hold_button_visualshader.tres b/addons/godot-xr-tools/misc/hold_button_visualshader.tres index 9c3b5e5c..359fa30b 100644 --- a/addons/godot-xr-tools/misc/hold_button_visualshader.tres +++ b/addons/godot-xr-tools/misc/hold_button_visualshader.tres @@ -7,8 +7,6 @@ operator = 3 [sub_resource type="VisualShaderNodeScalarUniform" id=2] uniform_name = "width" -default_value_enabled = true -default_value = 0.2 [sub_resource type="VisualShaderNodeScalarOp" id=11] output_port_for_preview = 0 @@ -21,8 +19,6 @@ operator = 1 [sub_resource type="VisualShaderNodeScalarUniform" id=13] uniform_name = "fade" -default_value_enabled = true -default_value = 0.05 [sub_resource type="VisualShaderNodeScalarOp" id=14] default_input_values = [ 0, 0.0, 1, 2.0 ] @@ -40,7 +36,6 @@ operator = 8 [sub_resource type="VisualShaderNodeColorUniform" id=3] uniform_name = "albedo" -default_value_enabled = true [sub_resource type="VisualShaderNodeVectorDecompose" id=18] @@ -61,9 +56,6 @@ operator = 3 [sub_resource type="VisualShaderNodeScalarUniform" id=23] uniform_name = "value" -hint = 1 -default_value_enabled = true -default_value = 0.2 [sub_resource type="VisualShaderNodeScalarOp" id=24] output_port_for_preview = 0 @@ -103,8 +95,6 @@ operator = 1 [sub_resource type="VisualShaderNodeScalarUniform" id=9] uniform_name = "radius" -default_value_enabled = true -default_value = 0.8 [sub_resource type="VisualShaderNodeScalarFunc" id=10] output_port_for_preview = 0 @@ -112,13 +102,13 @@ function = 12 [resource] code = "shader_type spatial; -render_mode specular_schlick_ggx, async_visible, unshaded; +render_mode specular_schlick_ggx, unshaded; -uniform vec4 albedo : hint_color = vec4(1.000000, 1.000000, 1.000000, 1.000000); -uniform float value : hint_range(0, 1) = 0.2; -uniform float fade = 0.05; -uniform float radius = 0.8; -uniform float width = 0.2; +uniform vec4 albedo : hint_color; +uniform float value; +uniform float fade; +uniform float radius; +uniform float width; @@ -303,4 +293,4 @@ nodes/fragment/29/node = SubResource( 26 ) nodes/fragment/29/position = Vector2( 1400, 60 ) nodes/fragment/30/node = SubResource( 27 ) nodes/fragment/30/position = Vector2( 1000, -240 ) -nodes/fragment/connections = PoolIntArray( 2, 0, 0, 0, 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 7, 0, 8, 0, 7, 1, 7, 0, 9, 0, 12, 0, 0, 1, 9, 0, 13, 0, 13, 0, 10, 0, 14, 0, 10, 1, 11, 0, 15, 0, 15, 0, 13, 1, 5, 0, 17, 0, 17, 0, 18, 0, 17, 0, 19, 0, 19, 0, 20, 0, 18, 0, 24, 0, 24, 0, 23, 1, 22, 0, 25, 0, 20, 2, 22, 0, 24, 0, 22, 3, 23, 0, 22, 4, 24, 0, 22, 5, 25, 0, 27, 0, 26, 0, 27, 1, 27, 0, 28, 0, 28, 0, 29, 0, 10, 0, 29, 1, 29, 0, 12, 1, 14, 0, 30, 0, 30, 0, 28, 1 ) +nodes/fragment/connections = PoolIntArray( 2, 0, 0, 0, 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 7, 0, 8, 0, 7, 1, 7, 0, 9, 0, 12, 0, 0, 1, 9, 0, 13, 0, 13, 0, 10, 0, 14, 0, 10, 1, 11, 0, 15, 0, 15, 0, 13, 1, 5, 0, 17, 0, 17, 0, 18, 0, 17, 0, 19, 0, 19, 0, 20, 0, 18, 0, 24, 0, 24, 0, 23, 1, 22, 0, 25, 0, 20, 2, 22, 0, 24, 0, 22, 3, 23, 0, 22, 4, 24, 0, 22, 5, 25, 0, 27, 0, 26, 0, 27, 1, 27, 0, 28, 0, 28, 0, 29, 0, 10, 0, 29, 1, 29, 0, 12, 1, 14, 0, 30, 0, 30, 0, 28, 1, 2, 0, 0, 0, 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 7, 0, 8, 0, 7, 1, 7, 0, 9, 0, 12, 0, 0, 1, 9, 0, 13, 0, 13, 0, 10, 0, 14, 0, 10, 1, 11, 0, 15, 0, 15, 0, 13, 1, 5, 0, 17, 0, 17, 0, 18, 0, 17, 0, 19, 0, 19, 0, 20, 0, 18, 0, 24, 0, 24, 0, 23, 1, 22, 0, 25, 0, 20, 2, 22, 0, 24, 0, 22, 3, 23, 0, 22, 4, 24, 0, 22, 5, 25, 0, 27, 0, 26, 0, 27, 1, 27, 0, 28, 0, 28, 0, 29, 0, 10, 0, 29, 1, 29, 0, 12, 1, 14, 0, 30, 0, 30, 0, 28, 1 ) diff --git a/addons/godot-xr-tools/misc/Move_To.gd b/addons/godot-xr-tools/misc/move_to.gd similarity index 98% rename from addons/godot-xr-tools/misc/Move_To.gd rename to addons/godot-xr-tools/misc/move_to.gd index 11ce8f04..fe0a3d50 100644 --- a/addons/godot-xr-tools/misc/Move_To.gd +++ b/addons/godot-xr-tools/misc/move_to.gd @@ -8,7 +8,7 @@ extends Node ## @desc: ## This node moves a control Spatial to the specified target Spatial ## at a requested speed. -## +## ## Signal invoked when the move finishes @@ -44,10 +44,10 @@ func _init(): func _process(delta: float) -> void: # Calculate the destination var destination := _target.global_transform * _offset - + # Update the move time _time += delta - + # Detect end of move if _time > _duration: # Disable processing @@ -62,7 +62,7 @@ func _process(delta: float) -> void: # Interpolate to the target _control.global_transform = _start.interpolate_with( - destination, + destination, _time / _duration) @@ -72,10 +72,10 @@ func start(var control: Spatial, var target: Spatial, var offset: Transform, var _control = control _target = target _offset = offset - + # Save the starting transform _start = control.global_transform - + # Calculate the duration var destination := _target.global_transform * _offset var distance := (destination.origin - _start.origin).length() diff --git a/addons/godot-xr-tools/misc/Velocity_Averager.gd b/addons/godot-xr-tools/misc/velocity_averager.gd similarity index 95% rename from addons/godot-xr-tools/misc/Velocity_Averager.gd rename to addons/godot-xr-tools/misc/velocity_averager.gd index d503f918..dd7b7c8e 100644 --- a/addons/godot-xr-tools/misc/Velocity_Averager.gd +++ b/addons/godot-xr-tools/misc/velocity_averager.gd @@ -1,4 +1,4 @@ -class_name VelocityAverager +class_name XRToolsVelocityAverager ## @@ -10,15 +10,15 @@ class_name VelocityAverager ## - Periodic distances ## - Periodic transforms (for the origin position) ## -## It provides the average velocity calculated from the total distance +## It provides the average velocity calculated from the total distance ## divided by the total time. -## +## # Count of averages to perform var _count: int -# Array of time deltas (in float seconds) +# Array of time deltas (in float seconds) var _time_deltas := Array() # Array of linear distances (Vector3 Castesian Distances) @@ -34,7 +34,7 @@ var _last_transform := Transform() var _has_last_transform := false -## Initialize the VelocityAverager with an averaging count +## Initialize the XRToolsVelocityAverager with an averaging count func _init(var count: int): _count = count @@ -49,7 +49,7 @@ func clear(): func add_distance(var delta: float, var linear_distance: Vector3, var angular_distance: Vector3): # Sanity check assert(delta > 0, "Velocity averager requires positive time-deltas") - + # Add data averaging arrays _time_deltas.push_back(delta) _linear_distances.push_back(linear_distance) @@ -71,13 +71,13 @@ func add_transform(var delta: float, var transform: Transform): # Calculate the linear cartesian distance var linear_distance := transform.origin - _last_transform.origin - + # Calculate the euler angular distance var angular_distance := (transform.basis * _last_transform.basis.inverse()).get_euler() - + # Update the last transform _last_transform = transform - + # Add distances add_distance(delta, linear_distance, angular_distance) @@ -115,7 +115,7 @@ func angular_velocity() -> Vector3: # to involve scaling of euler angles which isn't a valid operation. # # They are actually correct due to the value being a euler-velocity rather - # than a euler-angle. The difference is that physics engines process euler + # than a euler-angle. The difference is that physics engines process euler # velocities by converting them to axis-angle form by: # - Angle-velocity: euler-velocity vector magnitude # - Axis: euler-velocity normalized and axis evaluated on 1-radian rotation diff --git a/addons/godot-xr-tools/misc/Velocity_Averager_Linear.gd b/addons/godot-xr-tools/misc/velocity_averager_linear.gd similarity index 95% rename from addons/godot-xr-tools/misc/Velocity_Averager_Linear.gd rename to addons/godot-xr-tools/misc/velocity_averager_linear.gd index 36079ed9..38a76a82 100644 --- a/addons/godot-xr-tools/misc/Velocity_Averager_Linear.gd +++ b/addons/godot-xr-tools/misc/velocity_averager_linear.gd @@ -1,25 +1,25 @@ -class_name VelocityAveragerLinear +class_name XRToolsVelocityAveragerLinear ## ## Linear Velocity Averager class ## ## @desc: -## This class assists in calculating the average linear velocity of an +## This class assists in calculating the average linear velocity of an ## object. It accepts the following types of input: ## - Periodic distances ## - Periodic velocities ## - Periodic transforms (for the origin position) ## -## It provides the average velocity calculated from the total distance +## It provides the average velocity calculated from the total distance ## divided by the total time. -## +## # Count of averages to perform var _count: int -# Array of time deltas (in float seconds) +# Array of time deltas (in float seconds) var _time_deltas := Array() # Array of linear distances (in Vector3) @@ -67,7 +67,7 @@ func add_transform(var delta: float, var transform: Transform): # Calculate the linear distances var linear_distance := transform.origin - _last_transform.origin - + # Update the last transform _last_transform = transform diff --git a/addons/godot-xr-tools/misc/VR_Common_Shader_Cache.gd b/addons/godot-xr-tools/misc/vr_common_shader_cache.gd similarity index 91% rename from addons/godot-xr-tools/misc/VR_Common_Shader_Cache.gd rename to addons/godot-xr-tools/misc/vr_common_shader_cache.gd index 02254a90..b3191a05 100644 --- a/addons/godot-xr-tools/misc/VR_Common_Shader_Cache.gd +++ b/addons/godot-xr-tools/misc/vr_common_shader_cache.gd @@ -5,7 +5,7 @@ signal cooldown_finished var countdown = 2 # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): +func _process(_delta): countdown = countdown - 1 if countdown == 0: visible = false diff --git a/addons/godot-xr-tools/misc/VR_Common_Shader_Cache.tscn b/addons/godot-xr-tools/misc/vr_common_shader_cache.tscn similarity index 90% rename from addons/godot-xr-tools/misc/VR_Common_Shader_Cache.tscn rename to addons/godot-xr-tools/misc/vr_common_shader_cache.tscn index 8dd16dd1..6076e6b1 100644 --- a/addons/godot-xr-tools/misc/VR_Common_Shader_Cache.tscn +++ b/addons/godot-xr-tools/misc/vr_common_shader_cache.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=8 format=2] -[ext_resource path="res://addons/godot-xr-tools/misc/VR_Common_Shader_Cache.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/misc/vr_common_shader_cache.gd" type="Script" id=1] [ext_resource path="res://addons/godot-xr-tools/materials/teleport.tres" type="Material" id=2] [ext_resource path="res://addons/godot-xr-tools/materials/target.tres" type="Material" id=3] [ext_resource path="res://addons/godot-xr-tools/materials/capule.tres" type="Material" id=4] @@ -10,7 +10,7 @@ [sub_resource type="PlaneMesh" id=1] size = Vector2( 0.001, 0.001 ) -[node name="vr_common_shader_cache" type="Spatial"] +[node name="VRCommonShaderCache" type="Spatial"] script = ExtResource( 1 ) [node name="teleport" type="MeshInstance" parent="."] diff --git a/addons/godot-xr-tools/objects/Object_climbable.gd b/addons/godot-xr-tools/objects/Object_climbable.gd deleted file mode 100644 index e91ff85d..00000000 --- a/addons/godot-xr-tools/objects/Object_climbable.gd +++ /dev/null @@ -1,51 +0,0 @@ -class_name Object_climbable, "res://addons/godot-xr-tools/editor/icons/XRToolsHand.svg" -extends Spatial - -## -## Climbable Object -## -## @desc: -## This script adds climbing support to any StaticBody. -## -## For climbing to work, the player must have a Function_Climb_movement. -## - -var press_to_hold := true - -## Dictionary of grab locations by pickup -var grab_locations := {} - -# Called by Function_pickup -func is_picked_up() -> bool: - return false - -func can_pick_up(_by: Spatial) -> bool: - return true - -# Called by Function_pickup when user presses the action button while holding this object -func action(): - pass - -# Called by Function_pickup when this becomes the closest object to a controller -func increase_is_closest(): - pass - -# Called by Function_pickup when this stops being the closest object to a controller -func decrease_is_closest(): - pass - -# Called by Function_pickup when this is picked up by a controller -func pick_up(by: Spatial, with_controller: ARVRController) -> void: - save_grab_location(by) - -# Called by Function_pickup when this is let go by a controller -func let_go(p_linear_velocity: Vector3, p_angular_velocity: Vector3) -> void: - pass - -# Save the grab location -func save_grab_location(p: Spatial): - grab_locations[p.get_instance_id()] = to_local(p.global_transform.origin) - -# Get the grab location in world-space -func get_grab_location(p: Spatial) -> Vector3: - return to_global(grab_locations[p.get_instance_id()]) diff --git a/addons/godot-xr-tools/objects/Object_climbable.tscn b/addons/godot-xr-tools/objects/Object_climbable.tscn deleted file mode 100644 index b3512850..00000000 --- a/addons/godot-xr-tools/objects/Object_climbable.tscn +++ /dev/null @@ -1,8 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/godot-xr-tools/objects/Object_climbable.gd" type="Script" id=1] - -[node name="Object_climbable" type="StaticBody"] -script = ExtResource( 1 ) - -[node name="CollisionShape" type="CollisionShape" parent="."] diff --git a/addons/godot-xr-tools/objects/Snap_Zone.tscn b/addons/godot-xr-tools/objects/Snap_Zone.tscn deleted file mode 100644 index 0ed43c5f..00000000 --- a/addons/godot-xr-tools/objects/Snap_Zone.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/godot-xr-tools/objects/Snap_Zone.gd" type="Script" id=1] - -[sub_resource type="SphereShape" id=1] - -[node name="Snap_Zone" type="Area"] -script = ExtResource( 1 ) - -[node name="CollisionShape" type="CollisionShape" parent="."] -shape = SubResource( 1 ) - -[connection signal="body_entered" from="." to="." method="_on_Snap_Zone_body_entered"] -[connection signal="body_exited" from="." to="." method="_on_Snap_Zone_body_exited"] diff --git a/addons/godot-xr-tools/objects/Virtual_Keyboard.tscn b/addons/godot-xr-tools/objects/Virtual_Keyboard.tscn deleted file mode 100644 index b8c60803..00000000 --- a/addons/godot-xr-tools/objects/Virtual_Keyboard.tscn +++ /dev/null @@ -1,11 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn" type="PackedScene" id=2] - -[node name="Virtual_Keyboard" type="Spatial"] - -[node name="Viewport2Din3D" parent="." instance=ExtResource( 2 )] -screen_size = Vector2( 1.5, 0.558 ) -viewport_size = Vector2( 390, 145 ) -scene = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/objects/climbable.gd b/addons/godot-xr-tools/objects/climbable.gd new file mode 100644 index 00000000..b09c651d --- /dev/null +++ b/addons/godot-xr-tools/objects/climbable.gd @@ -0,0 +1,52 @@ +class_name XRToolsClimbable, "res://addons/godot-xr-tools/editor/icons/hand.svg" +extends Spatial + +## +## Climbable Object +## +## @desc: +## This script adds climbing support to any StaticBody. +## +## For climbing to work, the player must have a movement provider for +## climbing. +## + +var press_to_hold := true + +## Dictionary of grab locations by pickup +var grab_locations := {} + +# Called by XRToolsFunctionPickup +func is_picked_up() -> bool: + return false + +func can_pick_up(_by: Spatial) -> bool: + return true + +# Called by XRToolsFunctionPickup when user presses the action button while holding this object +func action(): + pass + +# Called by XRToolsFunctionPickup when this becomes the closest object to a controller +func increase_is_closest(): + pass + +# Called by XRToolsFunctionPickup when this stops being the closest object to a controller +func decrease_is_closest(): + pass + +# Called by XRToolsFunctionPickup when this is picked up by a controller +func pick_up(by: Spatial, _with_controller: ARVRController) -> void: + save_grab_location(by) + +# Called by XRToolsFunctionPickup when this is let go by a controller +func let_go(_p_linear_velocity: Vector3, _p_angular_velocity: Vector3) -> void: + pass + +# Save the grab location +func save_grab_location(p: Spatial): + grab_locations[p.get_instance_id()] = to_local(p.global_transform.origin) + +# Get the grab location in world-space +func get_grab_location(p: Spatial) -> Vector3: + return to_global(grab_locations[p.get_instance_id()]) diff --git a/addons/godot-xr-tools/objects/climbable.tscn b/addons/godot-xr-tools/objects/climbable.tscn new file mode 100644 index 00000000..9a77b177 --- /dev/null +++ b/addons/godot-xr-tools/objects/climbable.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/godot-xr-tools/objects/climbable.gd" type="Script" id=1] + +[node name="Climbable" type="StaticBody"] +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] diff --git a/addons/godot-xr-tools/objects/highlight/highlight_material.gd b/addons/godot-xr-tools/objects/highlight/highlight_material.gd index cde83452..39516b40 100644 --- a/addons/godot-xr-tools/objects/highlight/highlight_material.gd +++ b/addons/godot-xr-tools/objects/highlight/highlight_material.gd @@ -1,5 +1,5 @@ tool -class_name XRTHighlightMaterial +class_name XRToolsHighlightMaterial extends Node @@ -30,7 +30,7 @@ func _ready(): # Called when the pickable highlight changes -func _on_highlight_updated(pickable, enable: bool) -> void: +func _on_highlight_updated(_pickable, enable: bool) -> void: # Set the materials if _highlight_mesh_instance: for i in range(0, _highlight_mesh_instance.get_surface_material_count()): diff --git a/addons/godot-xr-tools/objects/highlight/highlight_ring.gd b/addons/godot-xr-tools/objects/highlight/highlight_ring.gd index ab17aa6a..8c5b65ef 100644 --- a/addons/godot-xr-tools/objects/highlight/highlight_ring.gd +++ b/addons/godot-xr-tools/objects/highlight/highlight_ring.gd @@ -1,5 +1,5 @@ tool -class_name XRTHighlightRing +class_name XRToolsHighlightRing extends MeshInstance @@ -14,7 +14,7 @@ func _ready(): # Called when the pickable highlight changes -func _on_highlight_updated(pickable, enable: bool) -> void: +func _on_highlight_updated(_pickable, enable: bool) -> void: visible = enable diff --git a/addons/godot-xr-tools/objects/highlight/highlight_ring.tscn b/addons/godot-xr-tools/objects/highlight/highlight_ring.tscn index bd7444cc..a0e8aae2 100644 --- a/addons/godot-xr-tools/objects/highlight/highlight_ring.tscn +++ b/addons/godot-xr-tools/objects/highlight/highlight_ring.tscn @@ -6,7 +6,7 @@ [sub_resource type="QuadMesh" id=1] size = Vector2( 0.05, 0.05 ) -[node name="XRTHighlightRing" type="MeshInstance"] +[node name="HighlightRing" type="MeshInstance"] mesh = SubResource( 1 ) material/0 = ExtResource( 2 ) script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/objects/highlight/highlight_visible.gd b/addons/godot-xr-tools/objects/highlight/highlight_visible.gd index b559efc1..084270b4 100644 --- a/addons/godot-xr-tools/objects/highlight/highlight_visible.gd +++ b/addons/godot-xr-tools/objects/highlight/highlight_visible.gd @@ -1,5 +1,5 @@ tool -class_name XRTHighlightVisible +class_name XRToolsHighlightVisible extends Spatial @@ -15,7 +15,7 @@ func _ready(): # Called when the pickable highlight changes -func _on_highlight_updated(pickable, enable: bool) -> void: +func _on_highlight_updated(_pickable, enable: bool) -> void: visible = enable diff --git a/addons/godot-xr-tools/objects/Interactable_area.gd b/addons/godot-xr-tools/objects/interactable_area.gd similarity index 100% rename from addons/godot-xr-tools/objects/Interactable_area.gd rename to addons/godot-xr-tools/objects/interactable_area.gd index 8a1ff9d3..6b3d3d5c 100644 --- a/addons/godot-xr-tools/objects/Interactable_area.gd +++ b/addons/godot-xr-tools/objects/interactable_area.gd @@ -1,6 +1,6 @@ +class_name XRToolsInteractableArea extends Area -class_name XRToolsInteractableArea signal pointer_pressed(at) signal pointer_released(at) diff --git a/addons/godot-xr-tools/objects/Interactable_body.gd b/addons/godot-xr-tools/objects/interactable_body.gd similarity index 100% rename from addons/godot-xr-tools/objects/Interactable_body.gd rename to addons/godot-xr-tools/objects/interactable_body.gd index bd4512cd..a6bdee82 100644 --- a/addons/godot-xr-tools/objects/Interactable_body.gd +++ b/addons/godot-xr-tools/objects/interactable_body.gd @@ -1,6 +1,6 @@ +class_name XRToolsInteractableBody extends PhysicsBody -class_name XRToolsInteractableBody signal pointer_pressed(at) signal pointer_released(at) diff --git a/addons/godot-xr-tools/objects/keyboard/VirtualKey.gd b/addons/godot-xr-tools/objects/keyboard/virtual_key.gd similarity index 86% rename from addons/godot-xr-tools/objects/keyboard/VirtualKey.gd rename to addons/godot-xr-tools/objects/keyboard/virtual_key.gd index 271ca59c..7312e0cd 100644 --- a/addons/godot-xr-tools/objects/keyboard/VirtualKey.gd +++ b/addons/godot-xr-tools/objects/keyboard/virtual_key.gd @@ -16,16 +16,16 @@ func _ready(): connect("button_down", keyboard, "on_key_pressed", [scan_code_text, unicode, shift_modifier]) # Get our virtual keyboard parent -func _get_virtual_keyboard() -> VirtualKeyboard2D: +func _get_virtual_keyboard() -> XRToolsVirtualKeyboard2D: # Get parent node and start walking up the tree var node = get_parent() while node: # Check if the node is the keyboard - if node is VirtualKeyboard2D: + if node is XRToolsVirtualKeyboard2D: return node # Step up the tree node = node.get_parent() - + # No virtual keyboard found return null diff --git a/addons/godot-xr-tools/objects/keyboard/VirtualKey.tscn b/addons/godot-xr-tools/objects/keyboard/virtual_key.tscn similarity index 86% rename from addons/godot-xr-tools/objects/keyboard/VirtualKey.tscn rename to addons/godot-xr-tools/objects/keyboard/virtual_key.tscn index 4489c82f..6a9497bc 100644 --- a/addons/godot-xr-tools/objects/keyboard/VirtualKey.tscn +++ b/addons/godot-xr-tools/objects/keyboard/virtual_key.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/VirtualKey.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/virtual_key.gd" type="Script" id=1] [node name="VirtualKey" type="Button"] margin_right = 30.0 diff --git a/addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.gd b/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd similarity index 83% rename from addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.gd rename to addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd index 66057777..756e051a 100644 --- a/addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.gd +++ b/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd @@ -1,8 +1,8 @@ -class_name VirtualKeyboard2D +class_name XRToolsVirtualKeyboard2D extends CanvasLayer # Enumeration of keyboard view modes -enum KEYBOARD_MODE { +enum KeyboardMode { LOWER_CASE, # Lower-case keys mode UPPER_CASE, # Upper-case keys mode ALTERNATE # Alternate keys mode @@ -18,7 +18,7 @@ var _caps_down := false var _alt_down := false # Current keyboard mode -var _mode: int = KEYBOARD_MODE.LOWER_CASE +var _mode: int = KeyboardMode.LOWER_CASE # Handle key pressed from VirtualKey @@ -76,11 +76,11 @@ func _update_visible(): # Evaluate the new mode var new_mode: int if _alt_down: - new_mode = KEYBOARD_MODE.ALTERNATE + new_mode = KeyboardMode.ALTERNATE elif _shift_down or _caps_down: - new_mode = KEYBOARD_MODE.UPPER_CASE + new_mode = KeyboardMode.UPPER_CASE else: - new_mode = KEYBOARD_MODE.LOWER_CASE + new_mode = KeyboardMode.LOWER_CASE # Skip if no change if new_mode == _mode: @@ -88,6 +88,6 @@ func _update_visible(): # Update the visible mode _mode = new_mode - $Background/LowerCase.visible = _mode == KEYBOARD_MODE.LOWER_CASE - $Background/UpperCase.visible = _mode == KEYBOARD_MODE.UPPER_CASE - $Background/Alternate.visible = _mode == KEYBOARD_MODE.ALTERNATE + $Background/LowerCase.visible = _mode == KeyboardMode.LOWER_CASE + $Background/UpperCase.visible = _mode == KeyboardMode.UPPER_CASE + $Background/Alternate.visible = _mode == KeyboardMode.ALTERNATE diff --git a/addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.tscn b/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn similarity index 99% rename from addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.tscn rename to addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn index bfabd6fb..7716249e 100644 --- a/addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.tscn +++ b/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.gd" type="Script" id=1] -[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/VirtualKey.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/virtual_key.tscn" type="PackedScene" id=2] -[node name="VirtualKeyboard_2D" type="CanvasLayer"] +[node name="VirtualKeyboard2D" type="CanvasLayer"] script = ExtResource( 1 ) [node name="Background" type="ColorRect" parent="."] diff --git a/addons/godot-xr-tools/objects/Object_pickable.gd b/addons/godot-xr-tools/objects/pickable.gd similarity index 99% rename from addons/godot-xr-tools/objects/Object_pickable.gd rename to addons/godot-xr-tools/objects/pickable.gd index 27525551..1ab5779a 100644 --- a/addons/godot-xr-tools/objects/Object_pickable.gd +++ b/addons/godot-xr-tools/objects/pickable.gd @@ -248,7 +248,7 @@ func _ranged_grab_complete() -> void: # Discard the XRToolsMoveTo performing the remote-grab _move_to.queue_free() _move_to = null - + # Perform the snap grab _do_snap_grab() diff --git a/addons/godot-xr-tools/objects/Object_pickable.tscn b/addons/godot-xr-tools/objects/pickable.tscn similarity index 50% rename from addons/godot-xr-tools/objects/Object_pickable.tscn rename to addons/godot-xr-tools/objects/pickable.tscn index 6288ad35..f9ec1437 100644 --- a/addons/godot-xr-tools/objects/Object_pickable.tscn +++ b/addons/godot-xr-tools/objects/pickable.tscn @@ -1,10 +1,9 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.gd" type="Script" id=1] -[node name="PickableObject" type="RigidBody"] +[node name="Pickable" type="RigidBody"] script = ExtResource( 1 ) -highlight_mesh_instance = null [node name="PickupCenter" type="Spatial" parent="."] diff --git a/addons/godot-xr-tools/objects/Snap_Zone.gd b/addons/godot-xr-tools/objects/snap_zone.gd similarity index 91% rename from addons/godot-xr-tools/objects/Snap_Zone.gd rename to addons/godot-xr-tools/objects/snap_zone.gd index 2aba83d7..f979a2ae 100644 --- a/addons/godot-xr-tools/objects/Snap_Zone.gd +++ b/addons/godot-xr-tools/objects/snap_zone.gd @@ -1,4 +1,4 @@ -class_name XRTSnapZone +class_name XRToolsSnapZone extends Area @@ -27,7 +27,7 @@ export var snap_exclude: String = "" ## Require grab-by to be in the specified group export var grab_require: String = "" -## Deny grab-by +## Deny grab-by export var grab_exclude: String= "" @@ -54,7 +54,7 @@ func _ready(): # Called on each frame to update the pickup -func _process(delta): +func _process(_delta): if is_instance_valid(picked_up_object): return @@ -77,7 +77,7 @@ func can_pick_up(by: Spatial) -> bool: # Refuse if the grab-by is not in the required group if not grab_require.empty() and not by.is_in_group(grab_require): return false - + # Refuse if the grab-by is in the excluded group if not grab_exclude.empty() and by.is_in_group(grab_exclude): return false @@ -107,16 +107,16 @@ func decrease_is_closest(): # Pickable Method: Object being grabbed from this snap zone -func pick_up(by: Spatial, with_controller: ARVRController) -> void: +func pick_up(_by: Spatial, _with_controller: ARVRController) -> void: pass # Pickable Method: Player never graps snap-zone -func let_go(p_linear_velocity: Vector3, p_angular_velocity: Vector3) -> void: +func let_go(_p_linear_velocity: Vector3, _p_angular_velocity: Vector3) -> void: pass -# Pickup Method: Drop the currently picked up object +# Pickup Method: Drop the currently picked up object func drop_object() -> void: if not is_instance_valid(picked_up_object): return @@ -128,7 +128,7 @@ func drop_object() -> void: emit_signal("highlight_updated", self, true) -func _on_Snap_Zone_body_entered(target: Spatial) -> void: +func _on_snap_zone_body_entered(target: Spatial) -> void: # Ignore objects already in area if _object_in_grab_area.find(target) >= 0: return @@ -146,7 +146,7 @@ func _on_Snap_Zone_body_entered(target: Spatial) -> void: return # Reject climbable objects - if target is Object_climbable: + if target is XRToolsClimbable: return # Add to the list of objects in grab area @@ -157,7 +157,7 @@ func _on_Snap_Zone_body_entered(target: Spatial) -> void: emit_signal("close_highlight_updated", self, true) -func _on_Snap_Zone_body_exited(target: Spatial) -> void: +func _on_snap_zone_body_exited(target: Spatial) -> void: _object_in_grab_area.erase(target) # Hide highlight when nothing could be snapped diff --git a/addons/godot-xr-tools/objects/snap_zone.tscn b/addons/godot-xr-tools/objects/snap_zone.tscn new file mode 100644 index 00000000..012b38c0 --- /dev/null +++ b/addons/godot-xr-tools/objects/snap_zone.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://addons/godot-xr-tools/objects/snap_zone.gd" type="Script" id=1] + +[sub_resource type="SphereShape" id=1] + +[node name="SnapZone" type="Area"] +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_snap_zone_body_entered"] +[connection signal="body_exited" from="." to="." method="_on_snap_zone_body_exited"] diff --git a/addons/godot-xr-tools/objects/Viewport_2D_in_3D.gd b/addons/godot-xr-tools/objects/viewport_2d_in_3d.gd similarity index 100% rename from addons/godot-xr-tools/objects/Viewport_2D_in_3D.gd rename to addons/godot-xr-tools/objects/viewport_2d_in_3d.gd diff --git a/addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn b/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn similarity index 82% rename from addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn rename to addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn index 718f2e41..fc6b8b7a 100644 --- a/addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn +++ b/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn @@ -1,27 +1,27 @@ [gd_scene load_steps=7 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D.gd" type="Script" id=1] -[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D_body.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d_body.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.gd" type="Script" id=2] [sub_resource type="QuadMesh" id=1] resource_local_to_scene = true size = Vector2( 3, 2 ) -[sub_resource type="ViewportTexture" id=2] +[sub_resource type="ViewportTexture" id=5] [sub_resource type="SpatialMaterial" id=3] resource_local_to_scene = true flags_transparent = true flags_unshaded = true params_cull_mode = 2 -albedo_texture = SubResource( 2 ) +albedo_texture = SubResource( 5 ) [sub_resource type="BoxShape" id=4] resource_local_to_scene = true extents = Vector3( 1.5, 1, 0.01 ) [node name="Viewport2Din3D" type="Spatial"] -script = ExtResource( 1 ) +script = ExtResource( 2 ) collision_layer = 1023 [node name="Viewport" type="Viewport" parent="."] @@ -36,9 +36,9 @@ mesh = SubResource( 1 ) material/0 = SubResource( 3 ) [node name="StaticBody" type="StaticBody" parent="."] -collision_layer = 15 +collision_layer = 1023 collision_mask = 0 -script = ExtResource( 2 ) +script = ExtResource( 1 ) viewport_size = Vector2( 300, 200 ) [node name="CollisionShape" type="CollisionShape" parent="StaticBody"] diff --git a/addons/godot-xr-tools/objects/Viewport_2D_in_3D_body.gd b/addons/godot-xr-tools/objects/viewport_2d_in_3d_body.gd similarity index 99% rename from addons/godot-xr-tools/objects/Viewport_2D_in_3D_body.gd rename to addons/godot-xr-tools/objects/viewport_2d_in_3d_body.gd index b81b83b0..9bab68a9 100644 --- a/addons/godot-xr-tools/objects/Viewport_2D_in_3D_body.gd +++ b/addons/godot-xr-tools/objects/viewport_2d_in_3d_body.gd @@ -14,30 +14,30 @@ func _ready(): func global_to_viewport(p_at): var t = $CollisionShape.global_transform var at = t.xform_inv(p_at) - + # Convert to screen space at.x = ((at.x / screen_size.x) + 0.5) * viewport_size.x at.y = (0.5 - (at.y / screen_size.y)) * viewport_size.y - + return Vector2(at.x, at.y) func _on_pointer_moved(from, to): var local_from = global_to_viewport(from) var local_to = global_to_viewport(to) - + # Let's mimic a mouse var event = InputEventMouseMotion.new() event.set_position(local_to) event.set_global_position(local_to) event.set_relative(local_to - local_from) # should this be scaled/warped? event.set_button_mask(mouse_mask) - + if vp: vp.input(event) func _on_pointer_pressed(at): var local_at = global_to_viewport(at) - + # Let's mimic a mouse mouse_mask = 1 var event = InputEventMouseButton.new() @@ -46,13 +46,13 @@ func _on_pointer_pressed(at): event.set_position(local_at) event.set_global_position(local_at) event.set_button_mask(mouse_mask) - + if vp: vp.input(event) func _on_pointer_released(at): var local_at = global_to_viewport(at) - + # Let's mimic a mouse mouse_mask = 0 var event = InputEventMouseButton.new() @@ -61,7 +61,7 @@ func _on_pointer_released(at): event.set_position(local_at) event.set_global_position(local_at) event.set_button_mask(mouse_mask) - + if vp: vp.input(event) diff --git a/addons/godot-xr-tools/objects/virtual_keyboard.tscn b/addons/godot-xr-tools/objects/virtual_keyboard.tscn new file mode 100644 index 00000000..033baaec --- /dev/null +++ b/addons/godot-xr-tools/objects/virtual_keyboard.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn" type="PackedScene" id=2] + +[node name="VirtualKeyboard" type="Spatial"] + +[node name="Viewport2Din3D" parent="." instance=ExtResource( 1 )] +screen_size = Vector2( 1.5, 0.558 ) +viewport_size = Vector2( 390, 145 ) +scene = ExtResource( 2 ) diff --git a/addons/godot-xr-tools/objects/Wind_area.gd b/addons/godot-xr-tools/objects/wind_area.gd similarity index 85% rename from addons/godot-xr-tools/objects/Wind_area.gd rename to addons/godot-xr-tools/objects/wind_area.gd index 1b88cdd1..80e90649 100644 --- a/addons/godot-xr-tools/objects/Wind_area.gd +++ b/addons/godot-xr-tools/objects/wind_area.gd @@ -1,4 +1,4 @@ -class_name WindArea +class_name XRToolsWindArea extends Area ## Vector (direction and magnitude) of wind in this area diff --git a/addons/godot-xr-tools/objects/Wind_area.tscn b/addons/godot-xr-tools/objects/wind_area.tscn similarity index 79% rename from addons/godot-xr-tools/objects/Wind_area.tscn rename to addons/godot-xr-tools/objects/wind_area.tscn index 54debf30..db87909b 100644 --- a/addons/godot-xr-tools/objects/Wind_area.tscn +++ b/addons/godot-xr-tools/objects/wind_area.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Wind_area.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/wind_area.gd" type="Script" id=1] [node name="WindArea" type="Area"] collision_layer = 65536 diff --git a/addons/godot-xr-tools/overrides/GroundPhysics.gd b/addons/godot-xr-tools/overrides/GroundPhysics.gd deleted file mode 100644 index 0fd39184..00000000 --- a/addons/godot-xr-tools/overrides/GroundPhysics.gd +++ /dev/null @@ -1,37 +0,0 @@ -tool -class_name GroundPhysics -extends Node - - -## -## Ground Physics Data -## -## @desc: -## This script works with the GroundPhysics asset override the default -## ground physics settings of the player when they are standing on a -## specific type of ground. -## -## In order to override the ground physics properties, the user must add a -## GroundPhysics node to the object the player would stand on, then -## enable the appropriate flags and provide new values. -## - -## GroundPhysicsSettings to apply - can only be typed in Godot 4+ -export var physics: Resource - -# This method verifies the MovementProvider has a valid configuration. -func _get_configuration_warning(): - # Verify physics specified - if !physics: - return "Physics must be specified" - - # Verify physics is of the correct type - if !physics is GroundPhysicsSettings: - return "Physics must be a GroundPhysicsSettings" - - # Report valid - return "" - -# Get the physics from a ground physics node -static func get_physics(var node: GroundPhysics, var default: GroundPhysicsSettings) -> GroundPhysicsSettings: - return node.physics as GroundPhysicsSettings if node else default diff --git a/addons/godot-xr-tools/overrides/ground_physics.gd b/addons/godot-xr-tools/overrides/ground_physics.gd new file mode 100644 index 00000000..cd29f2f2 --- /dev/null +++ b/addons/godot-xr-tools/overrides/ground_physics.gd @@ -0,0 +1,36 @@ +tool +class_name XRToolsGroundPhysics +extends Node + + +## +## Ground Physics Data +## +## @desc: +## This script override the default ground physics settings of the +## player when they are standing on a specific type of ground. +## +## In order to override the ground physics properties, the user must add a +## ground physics node to the object the player would stand on, then +## enable the appropriate flags and provide new values. +## + +## XRToolsGroundPhysicsSettings to apply - can only be typed in Godot 4+ +export var physics: Resource + +# This method verifies the ground physics has a valid configuration. +func _get_configuration_warning(): + # Verify physics specified + if !physics: + return "Physics must be specified" + + # Verify physics is of the correct type + if !physics is XRToolsGroundPhysicsSettings: + return "Physics must be an XRToolsGroundPhysicsSettings" + + # Report valid + return "" + +# Get the physics from a ground physics node +static func get_physics(var node: XRToolsGroundPhysics, var default: XRToolsGroundPhysicsSettings) -> XRToolsGroundPhysicsSettings: + return node.physics as XRToolsGroundPhysicsSettings if node else default diff --git a/addons/godot-xr-tools/overrides/GroundPhysics.tscn b/addons/godot-xr-tools/overrides/ground_physics.tscn similarity index 51% rename from addons/godot-xr-tools/overrides/GroundPhysics.tscn rename to addons/godot-xr-tools/overrides/ground_physics.tscn index bf7c6079..be29f73c 100644 --- a/addons/godot-xr-tools/overrides/GroundPhysics.tscn +++ b/addons/godot-xr-tools/overrides/ground_physics.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://addons/godot-xr-tools/overrides/GroundPhysics.gd" type="Script" id=1] +[ext_resource path="res://addons/godot-xr-tools/overrides/ground_physics.gd" type="Script" id=1] [node name="GroundPhysics" type="Node"] script = ExtResource( 1 ) diff --git a/addons/godot-xr-tools/overrides/GroundPhysicsSettings.gd b/addons/godot-xr-tools/overrides/ground_physics_settings.gd similarity index 62% rename from addons/godot-xr-tools/overrides/GroundPhysicsSettings.gd rename to addons/godot-xr-tools/overrides/ground_physics_settings.gd index d13aeba0..4bed983d 100644 --- a/addons/godot-xr-tools/overrides/GroundPhysicsSettings.gd +++ b/addons/godot-xr-tools/overrides/ground_physics_settings.gd @@ -1,5 +1,5 @@ tool -class_name GroundPhysicsSettings +class_name XRToolsGroundPhysicsSettings extends Resource ## Enumeration flags for which ground physics properties are enabled @@ -14,13 +14,13 @@ enum GroundPhysicsFlags { } ## Flags defining which ground velocities are enabled -export (int, FLAGS, - "Move Drag", - "Move Traction", - "Move Max Slope", - "Jump Max Slope", - "Jump Velocity", - "Bounciness", +export (int, FLAGS, + "Move Drag", + "Move Traction", + "Move Max Slope", + "Jump Max Slope", + "Jump Velocity", + "Bounciness", "Bounce Threshold") var flags := 0 ## Movement drag factor @@ -50,10 +50,10 @@ export var bounce_threshold := 1.0 # Handle class initialization with default parameters func _init( - p_flags = 0, - p_move_drag = 5.0, - p_move_traction = 30.0, - p_move_max_slope = 45.0, + p_flags = 0, + p_move_drag = 5.0, + p_move_traction = 30.0, + p_move_max_slope = 45.0, p_jump_max_slope = 45.0, p_jump_velocity = 3.0, p_bounciness = 0.0, @@ -68,44 +68,44 @@ func _init( bounciness = p_bounciness bounce_threshold = p_bounce_threshold -static func get_move_drag(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: +static func get_move_drag(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.MOVE_DRAG: return override.move_drag - else: - return default.move_drag -static func get_move_traction(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.move_drag + +static func get_move_traction(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.MOVE_TRACTION: return override.move_traction - else: - return default.move_traction -static func get_move_max_slope(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.move_traction + +static func get_move_max_slope(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.MOVE_MAX_SLOPE: return override.move_max_slope - else: - return default.move_max_slope -static func get_jump_max_slope(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.move_max_slope + +static func get_jump_max_slope(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.JUMP_MAX_SLOP: return override.jump_max_slope - else: - return default.jump_max_slope -static func get_jump_velocity(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.jump_max_slope + +static func get_jump_velocity(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.JUMP_VELOCITY: return override.jump_velocity - else: - return default.jump_velocity -static func get_bounciness(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.jump_velocity + +static func get_bounciness(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.BOUNCINESS: return override.bounciness - else: - return default.bounciness -static func get_bounce_threshold(override: GroundPhysicsSettings, default: GroundPhysicsSettings) -> float: + return default.bounciness + +static func get_bounce_threshold(override: XRToolsGroundPhysicsSettings, default: XRToolsGroundPhysicsSettings) -> float: if override and override.flags & GroundPhysicsFlags.BOUNCE_THRESHOLD: return override.bounce_threshold - else: - return default.bounce_threshold + + return default.bounce_threshold diff --git a/assets/meshes/interactables/joystick_smooth.tscn b/assets/meshes/interactables/joystick_smooth.tscn index 2313c326..949fce06 100644 --- a/assets/meshes/interactables/joystick_smooth.tscn +++ b/assets/meshes/interactables/joystick_smooth.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_joystick.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.1, 0.05 ) diff --git a/assets/meshes/interactables/joystick_snap.tscn b/assets/meshes/interactables/joystick_snap.tscn index 8d49f722..e398390e 100644 --- a/assets/meshes/interactables/joystick_snap.tscn +++ b/assets/meshes/interactables/joystick_snap.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_joystick.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.1, 0.05 ) diff --git a/assets/meshes/interactables/joystick_zero.tscn b/assets/meshes/interactables/joystick_zero.tscn index 3fe3f7a3..1624cb97 100644 --- a/assets/meshes/interactables/joystick_zero.tscn +++ b/assets/meshes/interactables/joystick_zero.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_joystick.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.1, 0.05 ) diff --git a/assets/meshes/interactables/lever_smooth.tscn b/assets/meshes/interactables/lever_smooth.tscn index 7480d708..c96f0fd3 100644 --- a/assets/meshes/interactables/lever_smooth.tscn +++ b/assets/meshes/interactables/lever_smooth.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_hinge.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/lever_snap.tscn b/assets/meshes/interactables/lever_snap.tscn index 186037e8..df36fe63 100644 --- a/assets/meshes/interactables/lever_snap.tscn +++ b/assets/meshes/interactables/lever_snap.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_hinge.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/lever_zero.tscn b/assets/meshes/interactables/lever_zero.tscn index 6736a5cd..7c61126c 100644 --- a/assets/meshes/interactables/lever_zero.tscn +++ b/assets/meshes/interactables/lever_zero.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_hinge.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/push_button.tscn b/assets/meshes/interactables/push_button.tscn index dfe45e41..5bb685bb 100644 --- a/assets/meshes/interactables/push_button.tscn +++ b/assets/meshes/interactables/push_button.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=9 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_area_button.gd" type="Script" id=2] [sub_resource type="CylinderShape" id=1] radius = 0.05 diff --git a/assets/meshes/interactables/slider_smooth.tscn b/assets/meshes/interactables/slider_smooth.tscn index 447b38eb..9f131fd2 100644 --- a/assets/meshes/interactables/slider_smooth.tscn +++ b/assets/meshes/interactables/slider_smooth.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_slider.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_slider.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/slider_snap.tscn b/assets/meshes/interactables/slider_snap.tscn index 485412d6..cc48b10a 100644 --- a/assets/meshes/interactables/slider_snap.tscn +++ b/assets/meshes/interactables/slider_snap.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_slider.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_slider.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/slider_zero.tscn b/assets/meshes/interactables/slider_zero.tscn index 87a3e7b1..833ebc6d 100644 --- a/assets/meshes/interactables/slider_zero.tscn +++ b/assets/meshes/interactables/slider_zero.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_slider.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_slider.gd" type="Script" id=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=3] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=4] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=4] [sub_resource type="BoxShape" id=1] extents = Vector3( 0.1, 0.3, 0.05 ) diff --git a/assets/meshes/interactables/wheel_smooth.tscn b/assets/meshes/interactables/wheel_smooth.tscn index 199fb2f4..deebbd8c 100644 --- a/assets/meshes/interactables/wheel_smooth.tscn +++ b/assets/meshes/interactables/wheel_smooth.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=7 format=2] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=1] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" type="Script" id=2] -[ext_resource path="res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" type="Script" id=3] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_hinge.gd" type="Script" id=2] +[ext_resource path="res://addons/godot-xr-tools/interactables/interactable_handle.gd" type="Script" id=3] [sub_resource type="CylinderShape" id=1] radius = 0.2 diff --git a/loading_screen/loading_screen_shader.tres b/loading_screen/loading_screen_shader.tres index 5906b065..a2b04234 100644 --- a/loading_screen/loading_screen_shader.tres +++ b/loading_screen/loading_screen_shader.tres @@ -9,10 +9,6 @@ condition = 1 [sub_resource type="VisualShaderNodeScalarUniform" id=6] uniform_name = "progress" -hint = 2 -step = 0.01 -default_value_enabled = true -default_value = 0.5 [sub_resource type="VisualShaderNodeVectorCompose" id=7] @@ -22,7 +18,6 @@ operator = 6 [sub_resource type="VisualShaderNodeColorUniform" id=9] uniform_name = "bar_color" -default_value_enabled = true [sub_resource type="VisualShaderNodeTextureUniform" id=17] uniform_name = "bar_texture" @@ -57,11 +52,11 @@ condition = 1 [resource] code = "shader_type spatial; -render_mode specular_schlick_ggx, async_visible, unshaded; +render_mode specular_schlick_ggx, unshaded; -uniform vec4 bar_color : hint_color = vec4(1.000000, 1.000000, 1.000000, 1.000000); +uniform vec4 bar_color : hint_color; uniform sampler2D bar_texture : hint_albedo; -uniform float progress : hint_range(0, 1, 0.01) = 0.5; +uniform float progress; @@ -170,4 +165,4 @@ nodes/fragment/17/node = SubResource( 18 ) nodes/fragment/17/position = Vector2( 980, 340 ) nodes/fragment/18/node = SubResource( 19 ) nodes/fragment/18/position = Vector2( 980, 560 ) -nodes/fragment/connections = PoolIntArray( 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 8, 0, 3, 0, 11, 0, 13, 0, 11, 1, 12, 0, 13, 0, 8, 0, 14, 0, 11, 0, 14, 1, 15, 0, 17, 0, 16, 0, 17, 1, 17, 0, 0, 0, 16, 1, 18, 0, 18, 0, 0, 1, 14, 0, 18, 1 ) +nodes/fragment/connections = PoolIntArray( 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 8, 0, 3, 0, 11, 0, 13, 0, 11, 1, 12, 0, 13, 0, 8, 0, 14, 0, 11, 0, 14, 1, 15, 0, 17, 0, 16, 0, 17, 1, 17, 0, 0, 0, 16, 1, 18, 0, 18, 0, 0, 1, 14, 0, 18, 1, 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 8, 0, 3, 0, 11, 0, 13, 0, 11, 1, 12, 0, 13, 0, 8, 0, 14, 0, 11, 0, 14, 1, 15, 0, 17, 0, 16, 0, 17, 1, 17, 0, 0, 0, 16, 1, 18, 0, 18, 0, 0, 1, 14, 0, 18, 1 ) diff --git a/project.godot b/project.godot index 718a722d..7b894d8d 100644 --- a/project.godot +++ b/project.godot @@ -12,256 +12,256 @@ _global_script_classes=[ { "base": "Reference", "class": "ARVRHelpers", "language": "GDScript", -"path": "res://addons/godot-xr-tools/misc/ARVR_Helpers.gd" +"path": "res://addons/godot-xr-tools/misc/arvr_helpers.gd" }, { -"base": "MovementProvider", -"class": "Function_ClimbMovement", +"base": "Spatial", +"class": "SceneBase", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Climb_movement.gd" +"path": "res://scenes/scene_base.gd" }, { -"base": "MovementProvider", -"class": "Function_CrouchMovement", +"base": "Spatial", +"class": "Teleport", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Crouch_movement.gd" +"path": "res://assets/meshes/teleport/teleport.gd" }, { -"base": "MovementProvider", -"class": "Function_DirectMovement", +"base": "Spatial", +"class": "XRToolsClimbable", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Direct_movement.gd" +"path": "res://addons/godot-xr-tools/objects/climbable.gd" }, { -"base": "MovementProvider", -"class": "Function_FallDamage", +"base": "XRToolsMovementProvider", +"class": "XRToolsDirectMovement", "language": "GDScript", -"path": "res://addons/godot-xr-tools/examples/Function_Fall_damage.gd" +"path": "res://addons/godot-xr-tools/functions/movement_direct.gd" }, { -"base": "MovementProvider", -"class": "Function_FlightMovement", +"base": "XRToolsMovementProvider", +"class": "XRToolsFallDamage", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Flight_movement.gd" +"path": "res://addons/godot-xr-tools/examples/fall_damage.gd" }, { -"base": "MovementProvider", -"class": "Function_Glide", +"base": "XRToolsMovementProvider", +"class": "XRToolsFlightMovement", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Glide_movement.gd" +"path": "res://addons/godot-xr-tools/functions/movement_flight.gd" }, { -"base": "MovementProvider", -"class": "Function_Grapple", +"base": "Spatial", +"class": "XRToolsFunctionPickup", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Grapple_movement.gd" +"path": "res://addons/godot-xr-tools/functions/function_pickup.gd" }, { -"base": "MovementProvider", -"class": "Function_Jump", +"base": "Node", +"class": "XRToolsGroundPhysics", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Jump_movement.gd" +"path": "res://addons/godot-xr-tools/overrides/ground_physics.gd" }, { -"base": "MovementProvider", -"class": "Function_JumpDetect", +"base": "Resource", +"class": "XRToolsGroundPhysicsSettings", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_JumpDetect_movement.gd" +"path": "res://addons/godot-xr-tools/overrides/ground_physics_settings.gd" }, { "base": "Spatial", -"class": "Function_Pickup", -"language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Pickup.gd" -}, { -"base": "MovementProvider", -"class": "Function_TurnMovement", +"class": "XRToolsHand", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Turn_movement.gd" +"path": "res://addons/godot-xr-tools/assets/hand.gd" }, { -"base": "MovementProvider", -"class": "Function_WindMovement", +"base": "BoneAttachment", +"class": "XRToolsHandPhysicsBone", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/Function_Wind_movement.gd" +"path": "res://addons/godot-xr-tools/assets/hand_physics_bone.gd" }, { "base": "Node", -"class": "GroundPhysics", +"class": "XRToolsHighlightMaterial", "language": "GDScript", -"path": "res://addons/godot-xr-tools/overrides/GroundPhysics.gd" +"path": "res://addons/godot-xr-tools/objects/highlight/highlight_material.gd" }, { -"base": "Resource", -"class": "GroundPhysicsSettings", +"base": "MeshInstance", +"class": "XRToolsHighlightRing", "language": "GDScript", -"path": "res://addons/godot-xr-tools/overrides/GroundPhysicsSettings.gd" +"path": "res://addons/godot-xr-tools/objects/highlight/highlight_ring.gd" }, { -"base": "Node", -"class": "MovementProvider", +"base": "Spatial", +"class": "XRToolsHighlightVisible", "language": "GDScript", -"path": "res://addons/godot-xr-tools/functions/MovementProvider.gd" +"path": "res://addons/godot-xr-tools/objects/highlight/highlight_visible.gd" }, { "base": "Spatial", -"class": "Object_climbable", +"class": "XRToolsHoldButton", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Object_climbable.gd" +"path": "res://addons/godot-xr-tools/misc/hold_button.gd" }, { -"base": "Node", -"class": "PlayerBody", +"base": "Area", +"class": "XRToolsInteractableArea", "language": "GDScript", -"path": "res://addons/godot-xr-tools/assets/PlayerBody.gd" +"path": "res://addons/godot-xr-tools/objects/interactable_area.gd" }, { -"base": "Spatial", -"class": "SceneBase", +"base": "Area", +"class": "XRToolsInteractableAreaButton", "language": "GDScript", -"path": "res://scenes/scene_base.gd" +"path": "res://addons/godot-xr-tools/interactables/interactable_area_button.gd" }, { -"base": "Spatial", -"class": "Teleport", +"base": "PhysicsBody", +"class": "XRToolsInteractableBody", "language": "GDScript", -"path": "res://assets/meshes/teleport/teleport.gd" +"path": "res://addons/godot-xr-tools/objects/interactable_body.gd" }, { -"base": "Reference", -"class": "VelocityAverager", +"base": "XRToolsPickable", +"class": "XRToolsInteractableHandle", "language": "GDScript", -"path": "res://addons/godot-xr-tools/misc/Velocity_Averager.gd" +"path": "res://addons/godot-xr-tools/interactables/interactable_handle.gd" }, { -"base": "Reference", -"class": "VelocityAveragerLinear", +"base": "Spatial", +"class": "XRToolsInteractableHandleDriven", "language": "GDScript", -"path": "res://addons/godot-xr-tools/misc/Velocity_Averager_Linear.gd" +"path": "res://addons/godot-xr-tools/interactables/interactable_handle_driven.gd" }, { -"base": "CanvasLayer", -"class": "VirtualKeyboard2D", +"base": "XRToolsInteractableHandleDriven", +"class": "XRToolsInteractableHinge", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/keyboard/VirtualKeyboard_2D.gd" +"path": "res://addons/godot-xr-tools/interactables/interactable_hinge.gd" }, { -"base": "Area", -"class": "WindArea", +"base": "XRToolsInteractableHandleDriven", +"class": "XRToolsInteractableJoystick", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Wind_area.gd" +"path": "res://addons/godot-xr-tools/interactables/interactable_joystick.gd" +}, { +"base": "XRToolsInteractableHandleDriven", +"class": "XRToolsInteractableSlider", +"language": "GDScript", +"path": "res://addons/godot-xr-tools/interactables/interactable_slider.gd" }, { "base": "Node", -"class": "XRTHighlightMaterial", +"class": "XRToolsMoveTo", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/highlight/highlight_material.gd" +"path": "res://addons/godot-xr-tools/misc/move_to.gd" }, { -"base": "MeshInstance", -"class": "XRTHighlightRing", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementClimb", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/highlight/highlight_ring.gd" +"path": "res://addons/godot-xr-tools/functions/movement_climb.gd" }, { -"base": "Spatial", -"class": "XRTHighlightVisible", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementCrouch", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/highlight/highlight_visible.gd" +"path": "res://addons/godot-xr-tools/functions/movement_crouch.gd" }, { -"base": "Area", -"class": "XRTInteractableAreaButton", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementGlide", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_area_button.gd" +"path": "res://addons/godot-xr-tools/functions/movement_glide.gd" }, { -"base": "XRToolsPickable", -"class": "XRTInteractableHandle", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementGrapple", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_handle.gd" +"path": "res://addons/godot-xr-tools/functions/movement_grapple.gd" }, { -"base": "Spatial", -"class": "XRTInteractableHandleDriven", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementJump", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_handle_driven.gd" +"path": "res://addons/godot-xr-tools/functions/movement_jump.gd" }, { -"base": "XRTInteractableHandleDriven", -"class": "XRTInteractableHinge", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementJumpDetect", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_hinge.gd" +"path": "res://addons/godot-xr-tools/functions/movement_jump_detect.gd" }, { -"base": "XRTInteractableHandleDriven", -"class": "XRTInteractableJoystick", +"base": "Node", +"class": "XRToolsMovementProvider", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_joystick.gd" +"path": "res://addons/godot-xr-tools/functions/movement_provider.gd" }, { -"base": "XRTInteractableHandleDriven", -"class": "XRTInteractableSlider", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementTurn", "language": "GDScript", -"path": "res://addons/godot-xr-tools/interactables/xrt_interactable_slider.gd" +"path": "res://addons/godot-xr-tools/functions/movement_turn.gd" }, { -"base": "Area", -"class": "XRTSnapZone", +"base": "XRToolsMovementProvider", +"class": "XRToolsMovementWind", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Snap_Zone.gd" +"path": "res://addons/godot-xr-tools/functions/movement_wind.gd" }, { -"base": "Spatial", -"class": "XRToolsHand", +"base": "XRToolsHand", +"class": "XRToolsPhysicsHand", "language": "GDScript", -"path": "res://addons/godot-xr-tools/assets/Hand.gd" +"path": "res://addons/godot-xr-tools/assets/physics_hand.gd" }, { -"base": "BoneAttachment", -"class": "XRToolsHandPhysicsBone", +"base": "RigidBody", +"class": "XRToolsPickable", "language": "GDScript", -"path": "res://addons/godot-xr-tools/assets/HandPhysicsBone.gd" +"path": "res://addons/godot-xr-tools/objects/pickable.gd" }, { -"base": "Spatial", -"class": "XRToolsHoldButton", +"base": "Node", +"class": "XRToolsPlayerBody", "language": "GDScript", -"path": "res://addons/godot-xr-tools/misc/hold_button.gd" +"path": "res://addons/godot-xr-tools/assets/player_body.gd" }, { "base": "Area", -"class": "XRToolsInteractableArea", +"class": "XRToolsSnapZone", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Interactable_area.gd" +"path": "res://addons/godot-xr-tools/objects/snap_zone.gd" }, { -"base": "PhysicsBody", -"class": "XRToolsInteractableBody", +"base": "Reference", +"class": "XRToolsVelocityAverager", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Interactable_body.gd" +"path": "res://addons/godot-xr-tools/misc/velocity_averager.gd" }, { -"base": "Node", -"class": "XRToolsMoveTo", +"base": "Reference", +"class": "XRToolsVelocityAveragerLinear", "language": "GDScript", -"path": "res://addons/godot-xr-tools/misc/Move_To.gd" +"path": "res://addons/godot-xr-tools/misc/velocity_averager_linear.gd" }, { -"base": "XRToolsHand", -"class": "XRToolsPhysicsHand", +"base": "CanvasLayer", +"class": "XRToolsVirtualKeyboard2D", "language": "GDScript", -"path": "res://addons/godot-xr-tools/assets/PhysicsHand.gd" +"path": "res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd" }, { -"base": "RigidBody", -"class": "XRToolsPickable", +"base": "Area", +"class": "XRToolsWindArea", "language": "GDScript", -"path": "res://addons/godot-xr-tools/objects/Object_pickable.gd" +"path": "res://addons/godot-xr-tools/objects/wind_area.gd" } ] _global_script_class_icons={ "ARVRHelpers": "", -"Function_ClimbMovement": "", -"Function_CrouchMovement": "", -"Function_DirectMovement": "", -"Function_FallDamage": "", -"Function_FlightMovement": "", -"Function_Glide": "", -"Function_Grapple": "", -"Function_Jump": "", -"Function_JumpDetect": "", -"Function_Pickup": "res://addons/godot-xr-tools/editor/icons/XRToolsFunction.svg", -"Function_TurnMovement": "", -"Function_WindMovement": "", -"GroundPhysics": "", -"GroundPhysicsSettings": "", -"MovementProvider": "res://addons/godot-xr-tools/editor/icons/XRToolsMovementProvider.svg", -"Object_climbable": "res://addons/godot-xr-tools/editor/icons/XRToolsHand.svg", -"PlayerBody": "res://addons/godot-xr-tools/editor/icons/XRToolsBody.svg", "SceneBase": "", "Teleport": "", -"VelocityAverager": "", -"VelocityAveragerLinear": "", -"VirtualKeyboard2D": "", -"WindArea": "", -"XRTHighlightMaterial": "", -"XRTHighlightRing": "", -"XRTHighlightVisible": "", -"XRTInteractableAreaButton": "", -"XRTInteractableHandle": "", -"XRTInteractableHandleDriven": "", -"XRTInteractableHinge": "", -"XRTInteractableJoystick": "", -"XRTInteractableSlider": "", -"XRTSnapZone": "", -"XRToolsHand": "res://addons/godot-xr-tools/editor/icons/XRToolsHand.svg", +"XRToolsClimbable": "res://addons/godot-xr-tools/editor/icons/hand.svg", +"XRToolsDirectMovement": "", +"XRToolsFallDamage": "", +"XRToolsFlightMovement": "", +"XRToolsFunctionPickup": "res://addons/godot-xr-tools/editor/icons/function.svg", +"XRToolsGroundPhysics": "", +"XRToolsGroundPhysicsSettings": "", +"XRToolsHand": "res://addons/godot-xr-tools/editor/icons/hand.svg", "XRToolsHandPhysicsBone": "", +"XRToolsHighlightMaterial": "", +"XRToolsHighlightRing": "", +"XRToolsHighlightVisible": "", "XRToolsHoldButton": "", "XRToolsInteractableArea": "", +"XRToolsInteractableAreaButton": "", "XRToolsInteractableBody": "", +"XRToolsInteractableHandle": "", +"XRToolsInteractableHandleDriven": "", +"XRToolsInteractableHinge": "", +"XRToolsInteractableJoystick": "", +"XRToolsInteractableSlider": "", "XRToolsMoveTo": "", +"XRToolsMovementClimb": "", +"XRToolsMovementCrouch": "", +"XRToolsMovementGlide": "", +"XRToolsMovementGrapple": "", +"XRToolsMovementJump": "", +"XRToolsMovementJumpDetect": "", +"XRToolsMovementProvider": "res://addons/godot-xr-tools/editor/icons/movement_provider.svg", +"XRToolsMovementTurn": "", +"XRToolsMovementWind": "", "XRToolsPhysicsHand": "", -"XRToolsPickable": "" +"XRToolsPickable": "", +"XRToolsPlayerBody": "res://addons/godot-xr-tools/editor/icons/body.svg", +"XRToolsSnapZone": "", +"XRToolsVelocityAverager": "", +"XRToolsVelocityAveragerLinear": "", +"XRToolsVirtualKeyboard2D": "", +"XRToolsWindArea": "" } [application] diff --git a/scenes/basic_movement_demo/basic_movement_demo.tscn b/scenes/basic_movement_demo/basic_movement_demo.tscn index 58eff0ff..e2424986 100644 --- a/scenes/basic_movement_demo/basic_movement_demo.tscn +++ b/scenes/basic_movement_demo/basic_movement_demo.tscn @@ -1,15 +1,15 @@ [gd_scene load_steps=14 format=2] [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=3] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=6] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=7] [ext_resource path="res://assets/meshes/ramps/ramps.tscn" type="PackedScene" id=8] [ext_resource path="res://assets/meshes/mound/mound.tscn" type="PackedScene" id=9] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Jump_movement.tscn" type="PackedScene" id=10] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_jump.tscn" type="PackedScene" id=10] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=11] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=12] @@ -21,23 +21,28 @@ viewport_path = NodePath("Instructions/Viewport") [node name="LeftHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 3 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] +enabled = true +order = 10 max_speed = 3.0 strafe = true -[node name="Function_Jump_movement" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 10 )] +[node name="MovementJump" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 10 )] jump_button_id = 7 [node name="RightHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 2 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 5 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 5 )] +enabled = true +order = 10 max_speed = 3.0 +strafe = false -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 4 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 4 )] smooth_rotation = true -[node name="Function_Jump_movement" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 10 )] +[node name="MovementJump" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 10 )] jump_button_id = 7 [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 6 )] diff --git a/scenes/climbing_gliding_demo/climbing_gliding_demo.tscn b/scenes/climbing_gliding_demo/climbing_gliding_demo.tscn index d9237da8..0d865262 100644 --- a/scenes/climbing_gliding_demo/climbing_gliding_demo.tscn +++ b/scenes/climbing_gliding_demo/climbing_gliding_demo.tscn @@ -1,28 +1,28 @@ [gd_scene load_steps=29 format=2] [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=3] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=6] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Glide_movement.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Climb_movement.tscn" type="PackedScene" id=8] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_glide.tscn" type="PackedScene" id=7] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_climb.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pickup.tscn" type="PackedScene" id=9] [ext_resource path="res://assets/wahooney.itch.io/green_grid_triplanar.tres" type="Material" id=10] [ext_resource path="res://assets/wahooney.itch.io/brown_grid.png" type="Texture" id=11] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_climbable.gd" type="Script" id=12] +[ext_resource path="res://addons/godot-xr-tools/objects/climbable.gd" type="Script" id=12] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=13] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=14] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Jump_movement.tscn" type="PackedScene" id=15] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_jump.tscn" type="PackedScene" id=15] [ext_resource path="res://scenes/climbing_gliding_demo/hill_mesh.tres" type="CylinderMesh" id=16] [ext_resource path="res://scenes/climbing_gliding_demo/wind_area_shader.tres" type="Material" id=17] [ext_resource path="res://scenes/climbing_gliding_demo/hill_collider.tres" type="Shape" id=18] [ext_resource path="res://scenes/climbing_gliding_demo/cliff_mesh.tres" type="CylinderMesh" id=19] [ext_resource path="res://scenes/climbing_gliding_demo/cliff_collider.tres" type="Shape" id=20] [ext_resource path="res://assets/meshes/tube/tube_mesh.tres" type="ArrayMesh" id=21] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Wind_movement.tscn" type="PackedScene" id=22] -[ext_resource path="res://addons/godot-xr-tools/objects/Wind_area.gd" type="Script" id=23] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_wind.tscn" type="PackedScene" id=22] +[ext_resource path="res://addons/godot-xr-tools/objects/wind_area.gd" type="Script" id=23] [sub_resource type="CubeMesh" id=1] size = Vector3( 200, 1, 200 ) @@ -53,38 +53,43 @@ far = 400.0 [node name="LeftHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 2 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] +enabled = true +order = 10 max_speed = 3.0 strafe = true -[node name="Function_Pickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 9 )] +[node name="FunctionPickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 9 )] -[node name="Function_Jump_movement" parent="ARVROrigin/LeftHand" index="3" instance=ExtResource( 15 )] +[node name="MovementJump" parent="ARVROrigin/LeftHand" index="3" instance=ExtResource( 15 )] jump_button_id = 7 [node name="RightHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 3 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 5 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 5 )] +enabled = true +order = 10 max_speed = 3.0 +strafe = false -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 4 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 4 )] smooth_rotation = true -[node name="Function_Pickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 9 )] +[node name="FunctionPickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 9 )] -[node name="Function_Jump_movement" parent="ARVROrigin/RightHand" index="4" instance=ExtResource( 15 )] +[node name="MovementJump" parent="ARVROrigin/RightHand" index="4" instance=ExtResource( 15 )] jump_button_id = 7 [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 6 )] -[node name="Function_Climb_movement" parent="ARVROrigin" index="4" instance=ExtResource( 8 )] -left_pickup = NodePath("../LeftHand/Function_Pickup") -right_pickup = NodePath("../RightHand/Function_Pickup") +[node name="MovementClimb" parent="ARVROrigin" index="4" instance=ExtResource( 8 )] +left_pickup = NodePath("../LeftHand/FunctionPickup") +right_pickup = NodePath("../RightHand/FunctionPickup") -[node name="Function_Glide_movement" parent="ARVROrigin" index="5" instance=ExtResource( 7 )] +[node name="MovementGlide" parent="ARVROrigin" index="5" instance=ExtResource( 7 )] -[node name="Function_Wind_movement" parent="ARVROrigin" index="6" instance=ExtResource( 22 )] +[node name="MovementWind" parent="ARVROrigin" index="6" instance=ExtResource( 22 )] [node name="DirectionalLight" type="DirectionalLight" parent="." index="1"] transform = Transform( 0.866025, -0.321394, 0.383022, 0, 0.766044, 0.642788, -0.5, -0.55667, 0.663414, 0, 5, 0 ) diff --git a/scenes/grappling_demo/grappling_demo.tscn b/scenes/grappling_demo/grappling_demo.tscn index af61c5f6..35d3feb2 100644 --- a/scenes/grappling_demo/grappling_demo.tscn +++ b/scenes/grappling_demo/grappling_demo.tscn @@ -1,21 +1,21 @@ [gd_scene load_steps=23 format=2] [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Grapple_movement.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=3] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Climb_movement.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Jump_movement.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=6] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.tscn" type="PackedScene" id=8] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Glide_movement.tscn" type="PackedScene" id=9] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=10] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=11] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_grapple.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_climb.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_jump.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=7] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pickup.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_glide.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=10] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=11] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=12] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=13] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=14] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=15] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_climbable.gd" type="Script" id=16] +[ext_resource path="res://addons/godot-xr-tools/objects/climbable.gd" type="Script" id=16] [ext_resource path="res://scenes/grappling_demo/moving_platforms.gd" type="Script" id=17] [sub_resource type="CubeMesh" id=1] @@ -41,43 +41,43 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 24 ) [node name="LeftHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 6 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 3 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 3 )] max_speed = 3.0 strafe = true -[node name="Function_Jump_movement" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 5 )] +[node name="MovementJump" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 5 )] jump_button_id = 7 -[node name="Function_Pickup" parent="ARVROrigin/LeftHand" index="3" instance=ExtResource( 8 )] +[node name="FunctionPickup" parent="ARVROrigin/LeftHand" index="3" instance=ExtResource( 8 )] grab_collision_mask = 3 ranged_enable = false [node name="RightHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 10 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 3 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 3 )] max_speed = 3.0 -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 7 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 7 )] smooth_rotation = true -[node name="Function_Jump_movement" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 5 )] +[node name="MovementJump" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 5 )] jump_button_id = 7 -[node name="Function_Grapple_movement" parent="ARVROrigin/RightHand" index="4" instance=ExtResource( 2 )] +[node name="MovementGrapple" parent="ARVROrigin/RightHand" index="4" instance=ExtResource( 2 )] grapple_collision_mask = 2 -[node name="Function_Pickup" parent="ARVROrigin/RightHand" index="5" instance=ExtResource( 8 )] +[node name="FunctionPickup" parent="ARVROrigin/RightHand" index="5" instance=ExtResource( 8 )] grab_collision_mask = 3 ranged_enable = false [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 11 )] -[node name="Function_Climb_movement" parent="ARVROrigin" index="4" instance=ExtResource( 4 )] -left_pickup = NodePath("../LeftHand/Function_Pickup") -right_pickup = NodePath("../RightHand/Function_Pickup") +[node name="MovementClimb" parent="ARVROrigin" index="4" instance=ExtResource( 4 )] +left_pickup = NodePath("../LeftHand/FunctionPickup") +right_pickup = NodePath("../RightHand/FunctionPickup") -[node name="Function_Glide_movement" parent="ARVROrigin" index="5" instance=ExtResource( 9 )] +[node name="MovementGlide" parent="ARVROrigin" index="5" instance=ExtResource( 9 )] [node name="BasicMap" parent="." index="1" instance=ExtResource( 13 )] diff --git a/scenes/interactables_demo/interactables_demo.tscn b/scenes/interactables_demo/interactables_demo.tscn index 57dccd15..112381f3 100644 --- a/scenes/interactables_demo/interactables_demo.tscn +++ b/scenes/interactables_demo/interactables_demo.tscn @@ -5,12 +5,12 @@ [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=4] [ext_resource path="res://assets/meshes/interactables/slider_snap.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/assets/RightPhysicsHand.tscn" type="PackedScene" id=6] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=8] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=9] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=10] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftPhysicsHand.tscn" type="PackedScene" id=11] +[ext_resource path="res://addons/godot-xr-tools/assets/right_physics_hand.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pickup.tscn" type="PackedScene" id=7] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=10] +[ext_resource path="res://addons/godot-xr-tools/assets/left_physics_hand.tscn" type="PackedScene" id=11] [ext_resource path="res://assets/meshes/interactables/slider_smooth.tscn" type="PackedScene" id=12] [ext_resource path="res://assets/meshes/interactables/slider_zero.tscn" type="PackedScene" id=13] [ext_resource path="res://assets/meshes/interactables/lever_smooth.tscn" type="PackedScene" id=14] @@ -27,11 +27,11 @@ [node name="LeftPhysicsHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 11 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 8 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 8 )] max_speed = 3.0 strafe = true -[node name="Function_Pickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 7 )] +[node name="FunctionPickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 7 )] grab_collision_mask = 262144 ranged_enable = false ranged_collision_mask = 0 @@ -39,13 +39,13 @@ ranged_collision_mask = 0 [node name="RightPhysicsHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 6 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 8 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 8 )] max_speed = 3.0 -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 10 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 10 )] smooth_rotation = true -[node name="Function_Pickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 7 )] +[node name="FunctionPickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 7 )] grab_collision_mask = 262144 ranged_enable = false ranged_collision_mask = 0 diff --git a/scenes/main_menu/main_menu_level.tscn b/scenes/main_menu/main_menu_level.tscn index 4fe7d1ae..e1f08e83 100644 --- a/scenes/main_menu/main_menu_level.tscn +++ b/scenes/main_menu/main_menu_level.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=23 format=2] [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=3] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=6] [ext_resource path="res://scenes/basic_movement_demo/basic_movement_demo.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=8] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=9] [ext_resource path="res://scenes/basic_movement_demo/basic movement demo.png" type="Texture" id=10] [ext_resource path="res://scenes/teleport_demo/teleport_demo.tscn" type="PackedScene" id=11] @@ -28,17 +28,17 @@ [node name="LeftHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 3 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 6 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 6 )] max_speed = 3.0 strafe = true [node name="RightHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 2 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 6 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 6 )] max_speed = 3.0 -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 5 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 5 )] smooth_rotation = true [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 8 )] diff --git a/scenes/pickable_demo/grab_ball.tscn b/scenes/pickable_demo/grab_ball.tscn index 511cbc26..2bb3e1a3 100644 --- a/scenes/pickable_demo/grab_ball.tscn +++ b/scenes/pickable_demo/grab_ball.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=8 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/wahooney.itch.io/brown_grid_triplanar.tres" type="Material" id=2] [ext_resource path="res://addons/godot-xr-tools/objects/highlight/highlight_visible.gd" type="Script" id=3] diff --git a/scenes/pickable_demo/grab_cube.tscn b/scenes/pickable_demo/grab_cube.tscn index 2252472a..4d2d5be7 100644 --- a/scenes/pickable_demo/grab_cube.tscn +++ b/scenes/pickable_demo/grab_cube.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/wahooney.itch.io/green_grid_triplanar.tres" type="Material" id=3] @@ -25,4 +25,4 @@ shape = SubResource( 7 ) mesh = SubResource( 8 ) material/0 = ExtResource( 3 ) -[node name="XRTHighlightRing" parent="." index="3" instance=ExtResource( 2 )] +[node name="HighlightRing" parent="." index="3" instance=ExtResource( 2 )] diff --git a/scenes/pickable_demo/pickable_demo.tscn b/scenes/pickable_demo/pickable_demo.tscn index b9191061..ab43baf3 100644 --- a/scenes/pickable_demo/pickable_demo.tscn +++ b/scenes/pickable_demo/pickable_demo.tscn @@ -2,14 +2,14 @@ [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftPhysicsHand.tscn" type="PackedScene" id=3] -[ext_resource path="res://addons/godot-xr-tools/assets/RightPhysicsHand.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/assets/left_physics_hand.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/godot-xr-tools/assets/right_physics_hand.tscn" type="PackedScene" id=4] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=5] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=6] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.tscn" type="PackedScene" id=8] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=9] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=10] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=7] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pickup.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=10] [ext_resource path="res://scenes/pickable_demo/snap_toy_red.tscn" type="PackedScene" id=11] [ext_resource path="res://scenes/pickable_demo/snap_toy_yellow.tscn" type="PackedScene" id=12] [ext_resource path="res://scenes/pickable_demo/grab_ball.tscn" type="PackedScene" id=13] @@ -22,11 +22,11 @@ [node name="LeftPhysicsHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 3 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 7 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 7 )] max_speed = 3.0 strafe = true -[node name="Function_Pickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 8 )] +[node name="FunctionPickup" parent="ARVROrigin/LeftHand" index="2" instance=ExtResource( 8 )] grab_distance = 0.1 grab_collision_mask = 4 ranged_angle = 10.0 @@ -35,13 +35,13 @@ ranged_collision_mask = 4 [node name="RightPhysicsHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 4 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 7 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 7 )] max_speed = 3.0 -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 10 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 10 )] smooth_rotation = true -[node name="Function_Pickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 8 )] +[node name="FunctionPickup" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 8 )] grab_distance = 0.1 grab_collision_mask = 4 ranged_angle = 10.0 diff --git a/scenes/pickable_demo/snap_toy_red.tscn b/scenes/pickable_demo/snap_toy_red.tscn index cc669e84..e0a4c1e8 100644 --- a/scenes/pickable_demo/snap_toy_red.tscn +++ b/scenes/pickable_demo/snap_toy_red.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.tscn" type="PackedScene" id=2] [sub_resource type="ConvexPolygonShape" id=17] @@ -30,4 +30,4 @@ shape = SubResource( 17 ) mesh = SubResource( 1 ) material/0 = SubResource( 2 ) -[node name="XRTHighlightRing" parent="." index="3" instance=ExtResource( 2 )] +[node name="HighlightRing" parent="." index="3" instance=ExtResource( 2 )] diff --git a/scenes/pickable_demo/snap_toy_yellow.tscn b/scenes/pickable_demo/snap_toy_yellow.tscn index 1897e3a8..e7c62fed 100644 --- a/scenes/pickable_demo/snap_toy_yellow.tscn +++ b/scenes/pickable_demo/snap_toy_yellow.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.tscn" type="PackedScene" id=2] [sub_resource type="ConvexPolygonShape" id=20] @@ -30,4 +30,4 @@ shape = SubResource( 20 ) mesh = SubResource( 21 ) material/0 = SubResource( 22 ) -[node name="XRTHighlightRing" parent="." index="3" instance=ExtResource( 2 )] +[node name="HighlightRing" parent="." index="3" instance=ExtResource( 2 )] diff --git a/scenes/pickable_demo/snap_tray.tscn b/scenes/pickable_demo/snap_tray.tscn index 3282c492..cbfe8d54 100644 --- a/scenes/pickable_demo/snap_tray.tscn +++ b/scenes/pickable_demo/snap_tray.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=2] -[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/godot-xr-tools/objects/pickable.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/wahooney.itch.io/blue_grid.tres" type="Material" id=2] [ext_resource path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.tscn" type="PackedScene" id=3] -[ext_resource path="res://addons/godot-xr-tools/objects/Snap_Zone.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/objects/snap_zone.tscn" type="PackedScene" id=4] [sub_resource type="BoxShape" id=9] extents = Vector3( 0.15, 0.2, 0.05 ) @@ -52,7 +52,7 @@ collision_mask = 65536 grab_distance = 0.05 snap_require = "SnapToyRed" -[node name="XRTHighlightRing" parent="SnapArea1/SnapZone1" index="1" instance=ExtResource( 3 )] +[node name="HighlightRing" parent="SnapArea1/SnapZone1" index="1" instance=ExtResource( 3 )] [node name="SnapArea2" type="MeshInstance" parent="." index="4"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0.06, 0.06 ) @@ -66,7 +66,7 @@ collision_mask = 65536 grab_distance = 0.05 snap_require = "SnapToyYellow" -[node name="XRTHighlightRing" parent="SnapArea2/SnapZone2" index="1" instance=ExtResource( 3 )] +[node name="HighlightRing" parent="SnapArea2/SnapZone2" index="1" instance=ExtResource( 3 )] [node name="SnapArea3" type="MeshInstance" parent="." index="5"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06, -0.06, 0.06 ) @@ -80,7 +80,7 @@ collision_mask = 65536 grab_distance = 0.05 snap_require = "SnapToy" -[node name="XRTHighlightRing" parent="SnapArea3/SnapZone3" index="1" instance=ExtResource( 3 )] +[node name="HighlightRing" parent="SnapArea3/SnapZone3" index="1" instance=ExtResource( 3 )] [node name="SnapArea4" type="MeshInstance" parent="." index="6"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, -0.06, 0.06 ) @@ -94,4 +94,4 @@ collision_mask = 65536 grab_distance = 0.05 snap_require = "SnapToy" -[node name="XRTHighlightRing" parent="SnapArea4/SnapZone4" index="1" instance=ExtResource( 3 )] +[node name="HighlightRing" parent="SnapArea4/SnapZone4" index="1" instance=ExtResource( 3 )] diff --git a/scenes/pointer_demo/pointer_demo.tscn b/scenes/pointer_demo/pointer_demo.tscn index 7a9f0381..9662afe5 100644 --- a/scenes/pointer_demo/pointer_demo.tscn +++ b/scenes/pointer_demo/pointer_demo.tscn @@ -4,15 +4,15 @@ [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_pointer.tscn" type="PackedScene" id=5] -[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=6] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.tscn" type="PackedScene" id=7] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=8] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=9] -[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=10] -[ext_resource path="res://addons/godot-xr-tools/objects/Virtual_Keyboard.tscn" type="PackedScene" id=11] +[ext_resource path="res://addons/godot-xr-tools/functions/function_pointer.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=6] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_direct.tscn" type="PackedScene" id=7] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=8] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=10] +[ext_resource path="res://addons/godot-xr-tools/objects/virtual_keyboard.tscn" type="PackedScene" id=11] [ext_resource path="res://scenes/pointer_demo/keyboard_test_screen.tscn" type="PackedScene" id=12] -[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn" type="PackedScene" id=13] +[ext_resource path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" type="PackedScene" id=13] [ext_resource path="res://scenes/pointer_demo/color_change_cube.gd" type="Script" id=14] [sub_resource type="CubeMesh" id=1] @@ -26,20 +26,25 @@ extents = Vector3( 0.25, 0.25, 0.25 ) [node name="LeftHand" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 6 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 7 )] +[node name="MovementDirect" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 7 )] +enabled = true +order = 10 max_speed = 3.0 strafe = true [node name="RightHand" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 10 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.05, 0.15 ) -[node name="Function_Direct_movement" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 7 )] +[node name="MovementDirect" parent="ARVROrigin/RightHand" index="1" instance=ExtResource( 7 )] +enabled = true +order = 10 max_speed = 3.0 +strafe = false -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 9 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="2" instance=ExtResource( 9 )] smooth_rotation = true -[node name="Function_pointer" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 5 )] +[node name="FunctionPointer" parent="ARVROrigin/RightHand" index="3" instance=ExtResource( 5 )] [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 8 )] @@ -50,7 +55,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4 ) scene_base = NodePath("..") title = ExtResource( 4 ) -[node name="Virtual_Keyboard" parent="." index="3" instance=ExtResource( 11 )] +[node name="VirtualKeyboard" parent="." index="3" instance=ExtResource( 11 )] transform = Transform( 1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 1, -2 ) [node name="Display" parent="." index="4" instance=ExtResource( 13 )] diff --git a/scenes/teleport_demo/teleport_demo.tscn b/scenes/teleport_demo/teleport_demo.tscn index 7dbc0cb2..62015489 100644 --- a/scenes/teleport_demo/teleport_demo.tscn +++ b/scenes/teleport_demo/teleport_demo.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=11 format=2] [ext_resource path="res://scenes/scene_base.tscn" type="PackedScene" id=1] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Teleport.tscn" type="PackedScene" id=2] +[ext_resource path="res://addons/godot-xr-tools/functions/function_teleport.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/main_menu/return to main menu.png" type="Texture" id=3] -[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/godot-xr-tools/functions/Function_Turn_movement.tscn" type="PackedScene" id=5] +[ext_resource path="res://addons/godot-xr-tools/assets/player_body.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/godot-xr-tools/functions/movement_turn.tscn" type="PackedScene" id=5] [ext_resource path="res://assets/meshes/teleport/teleport.tscn" type="PackedScene" id=6] [ext_resource path="res://assets/maps/basic_map.tscn" type="PackedScene" id=7] [ext_resource path="res://assets/meshes/ramps/ramps.tscn" type="PackedScene" id=8] @@ -15,12 +15,12 @@ viewport_path = NodePath("Instructions/Viewport") [node name="TeleportDemo" instance=ExtResource( 1 )] -[node name="Function_Teleport" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 2 )] +[node name="FunctionTeleport" parent="ARVROrigin/LeftHand" index="0" instance=ExtResource( 2 )] camera = NodePath("../../ARVRCamera") -[node name="Function_Turn_movement" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] +[node name="MovementTurn" parent="ARVROrigin/LeftHand" index="1" instance=ExtResource( 5 )] -[node name="Function_Turn_movement" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 5 )] +[node name="MovementTurn" parent="ARVROrigin/RightHand" index="0" instance=ExtResource( 5 )] [node name="PlayerBody" parent="ARVROrigin" index="3" instance=ExtResource( 4 )] diff --git a/staging.tscn b/staging.tscn index c7dc61e0..4be3ea9f 100644 --- a/staging.tscn +++ b/staging.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://staging.gd" type="Script" id=2] [ext_resource path="res://loading_screen/loading_screen.tscn" type="PackedScene" id=3] [ext_resource path="res://loading_screen/fade.gdshader" type="Shader" id=4] -[ext_resource path="res://addons/godot-xr-tools/misc/VR_Common_Shader_Cache.tscn" type="PackedScene" id=9] +[ext_resource path="res://addons/godot-xr-tools/misc/vr_common_shader_cache.tscn" type="PackedScene" id=9] [sub_resource type="QuadMesh" id=4] custom_aabb = AABB( -5000, -5000, -5000, 10000, 10000, 10000 )