diff --git a/godot/CameraTest.tscn b/godot/CameraTest.tscn index 45f4782..31d0a98 100644 --- a/godot/CameraTest.tscn +++ b/godot/CameraTest.tscn @@ -1,16 +1,20 @@ -[gd_scene load_steps=3 format=3 uid="uid://dd64j7xcfl6io"] +[gd_scene load_steps=4 format=3 uid="uid://dd64j7xcfl6io"] [ext_resource type="PackedScene" uid="uid://csqyxbjumla33" path="res://player.tscn" id="1_i6frr"] +[ext_resource type="PackedScene" uid="uid://3d51hjh2st8a" path="res://Level/Island.tscn" id="2_cjk1r"] -[sub_resource type="BoxShape3D" id="BoxShape3D_r81py"] -size = Vector3(10, 1, 10) +[sub_resource type="CylinderShape3D" id="CylinderShape3D_cxihl"] +radius = 15.365 [node name="Node3D" type="Node3D"] [node name="Player" parent="." instance=ExtResource("1_i6frr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.93827, 12.3667, -12.0351) -[node name="RigidBody3D" type="RigidBody3D" parent="."] +[node name="Node3D" parent="." instance=ExtResource("2_cjk1r")] +transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, -0.279051, -4.39988, -1.78854) -[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -5, 0) -shape = SubResource("BoxShape3D_r81py") +[node name="StaticBody3D" type="StaticBody3D" parent="Node3D"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Node3D/StaticBody3D"] +shape = SubResource("CylinderShape3D_cxihl") diff --git a/godot/Player.gd b/godot/Player.gd index 69a4ef6..29f15a9 100644 --- a/godot/Player.gd +++ b/godot/Player.gd @@ -3,6 +3,8 @@ extends CharacterBody3D const SPEED = 5.0 const JUMP_VELOCITY = 4.5 +@export var horiz_sens = 0.25 +@export var vert_sens = 0.25 var playerCam # Get the gravity from the project settings to be synced with RigidBody nodes. @@ -11,12 +13,19 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") func _ready(): Input.mouse_mode = Input.MOUSE_MODE_CAPTURED playerCam = get_node("CameraMount") as Node3D + + +func _process(delta): + # Brings your mouse out of the window if you press escape. Add pause screen function here? + if Input.is_action_pressed("ui_cancel"): + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + func _input(event): # Handle the rotation of the camera using mouse movement. if event is InputEventMouseMotion: - playerCam.rotate_y(deg_to_rad(-event.relative.x)) - playerCam.rotate_x(deg_to_rad(event.relative.y)) + rotate_y(deg_to_rad(-event.relative.x * horiz_sens)) + playerCam.rotate_x(deg_to_rad(-event.relative.y * vert_sens)) func _physics_process(delta): # Add the gravity. diff --git a/godot/player.tscn b/godot/player.tscn index ab0a92b..bd905b8 100644 --- a/godot/player.tscn +++ b/godot/player.tscn @@ -24,5 +24,5 @@ surface_material_override/0 = SubResource("StandardMaterial3D_npbs0") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0) [node name="PlayerCam" type="Camera3D" parent="CameraMount"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 5) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4) fov = 105.5 diff --git a/godot/project.godot b/godot/project.godot index 3430d8e..6e1d6a4 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -22,3 +22,38 @@ project/assembly_name="abgj23" [filesystem] import/fbx/enabled=false + +[input] + +ui_left={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null) +] +} +ui_right={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null) +] +} +ui_up={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null) +] +} +ui_down={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null) +] +}