major breaking update to godot 4 beta 16
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.0.0-beta.13">
|
||||
<Project Sdk="Godot.NET.Sdk/4.0.0-beta.16">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
|
@@ -1,7 +0,0 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.0.0-beta.10">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<RootNamespace>gd-mono-thirdpersoncontroller</RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@@ -30,39 +30,35 @@ window/stretch/aspect="expand"
|
||||
|
||||
project/assembly_name="gd-mono-thirdpersoncontroller"
|
||||
|
||||
[editor]
|
||||
|
||||
export/convert_text_resources_to_binary=true
|
||||
|
||||
[input]
|
||||
|
||||
move_jump={
|
||||
"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":32,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":32,"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":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_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":65,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":65,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_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":68,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":68,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_forward={
|
||||
"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":87,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":87,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_backward={
|
||||
"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":83,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":83,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
@@ -88,14 +84,14 @@ gp_cam_down={
|
||||
}
|
||||
fullscreen={
|
||||
"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":4194342,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":true,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"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":4194342,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":true,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
uncapture_mouse={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, 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":4194327,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, 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":4194327,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -18,15 +18,15 @@ ssr_fade_out = 2.21914
|
||||
|
||||
[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_0vf24"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_hmqcx"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bxkt8"]
|
||||
size = Vector3(1, 1, 1.24943)
|
||||
size = Vector3(14, 7, 0.1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_hmqcx"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_p3q8d"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_pxtb0"]
|
||||
size = Vector3(1.994, 0.048, 2)
|
||||
size = Vector3(14, 0.1, 14)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_865hq"]
|
||||
|
||||
@@ -37,24 +37,24 @@ environment = SubResource("Environment_3olxv")
|
||||
camera_attributes = SubResource("CameraAttributesPhysical_0vf24")
|
||||
|
||||
[node name="wall" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(3.18901, 0, 0, 0, 1.018, 0, 0, 0, 7, 0, 0, -0.704191)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="wall"]
|
||||
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 0.02, 0.0452084, 2.24667, 1.0926)
|
||||
mesh = SubResource("BoxMesh_hmqcx")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="wall"]
|
||||
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 0.02, 0.04108, 2.19764, 1.09242)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 7)
|
||||
shape = SubResource("BoxShape3D_bxkt8")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="wall"]
|
||||
transform = Transform3D(14, 0, 0, 0, 7, 0, 0, 0, 0.018, 0, 3.5, 7)
|
||||
mesh = SubResource("BoxMesh_hmqcx")
|
||||
|
||||
[node name="ground" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(7.781, 0, 0, 0, 1.018, 0, 0, 0, 7, 0, 0, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="ground"]
|
||||
transform = Transform3D(7, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0)
|
||||
mesh = SubResource("PlaneMesh_p3q8d")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ground"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0)
|
||||
shape = SubResource("BoxShape3D_pxtb0")
|
||||
|
||||
[node name="cube" type="StaticBody3D" parent="."]
|
||||
|
@@ -3,6 +3,7 @@
|
||||
[ext_resource type="Script" path="res://src/player.cs" id="1_sqkid"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bfc1o"]
|
||||
height = 2.4
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_4c62m"]
|
||||
|
||||
@@ -22,11 +23,11 @@ font_size = 70
|
||||
script = ExtResource("1_sqkid")
|
||||
|
||||
[node name="collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1.2, 0, 0, 0, 1, 0, 1.2, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 0)
|
||||
shape = SubResource("CapsuleShape3D_bfc1o")
|
||||
|
||||
[node name="body" type="MeshInstance3D" parent="collision"]
|
||||
transform = Transform3D(0.999994, 0, 0.00349065, 0, 1, 0, -0.00349065, 0, 0.999994, 0, 0, 0)
|
||||
transform = Transform3D(0.999994, 0, 0.00349065, 0, 1.2, 0, -0.00349065, 0, 0.999994, 0, 0, 0)
|
||||
mesh = SubResource("CapsuleMesh_4c62m")
|
||||
skeleton = NodePath("")
|
||||
|
||||
|
@@ -23,7 +23,7 @@ public partial class player : CharacterBody3D
|
||||
if (direction != Vector3.Zero && Input.MouseMode == Input.MouseModeEnum.Captured | gamepadMode)
|
||||
{
|
||||
Vector3 bodyRotation = GetNode<MeshInstance3D>("collision/body").Rotation;
|
||||
bodyRotation.y = Mathf.LerpAngle(bodyRotation.y,Mathf.Atan2(-direction.x, -direction.z), (float)delta * speed);
|
||||
bodyRotation.Y = Mathf.LerpAngle(bodyRotation.Y,Mathf.Atan2(-direction.X, -direction.Z), (float)delta * speed);
|
||||
GetNode<MeshInstance3D>("collision/body").Rotation = bodyRotation;
|
||||
}
|
||||
//camera gamepad part (needs constant movement so _Input event wouldn't work with this like mouseinput)
|
||||
@@ -31,9 +31,9 @@ public partial class player : CharacterBody3D
|
||||
if(gpCamVector != Vector2.Zero)
|
||||
{
|
||||
Vector3 camRot = GetNode<Marker3D>("camera_center").RotationDegrees;
|
||||
camRot.y -= gpCamVector.x * camSensitivity * (float)delta * 500;
|
||||
camRot.x -= gpCamVector.y * camSensitivity * (float)delta * 500;
|
||||
camRot.x = Mathf.Clamp(camRot.x, minCamPitch, maxCamPitch); //prevents camera from going endlessly around the player
|
||||
camRot.Y -= gpCamVector.X * camSensitivity * (float)delta * 500;
|
||||
camRot.X -= gpCamVector.Y * camSensitivity * (float)delta * 500;
|
||||
camRot.X = Mathf.Clamp(camRot.X, minCamPitch, maxCamPitch); //prevents camera from going endlessly around the player
|
||||
GetNode<Marker3D>("camera_center").RotationDegrees = camRot;
|
||||
}
|
||||
}
|
||||
@@ -42,22 +42,22 @@ public partial class player : CharacterBody3D
|
||||
Vector3 velocity = Velocity;
|
||||
|
||||
if (!IsOnFloor())
|
||||
velocity.y -= gravity * (float)delta; //characterbodys don't have physic simulations by default like rigidbody
|
||||
velocity.Y -= gravity * (float)delta; //characterbodys don't have physic simulations by default like rigidbody
|
||||
|
||||
if (Input.IsActionJustPressed("move_jump") && IsOnFloor() && Input.MouseMode == Input.MouseModeEnum.Captured | gamepadMode)
|
||||
velocity.y = jumpVelocity;
|
||||
velocity.Y = jumpVelocity;
|
||||
|
||||
Vector2 inputDir = Input.GetVector("move_left", "move_right", "move_forward", "move_backward");
|
||||
direction = new Vector3(inputDir.x, 0, inputDir.y).Rotated(Vector3.Up, GetNode<Marker3D>("camera_center").Rotation.y).Normalized(); //rotates the input direction with camera rotation
|
||||
direction = new Vector3(inputDir.X, 0, inputDir.Y).Rotated(Vector3.Up, GetNode<Marker3D>("camera_center").Rotation.Y).Normalized(); //rotates the input direction with camera rotation
|
||||
if (direction != Vector3.Zero && Input.MouseMode == Input.MouseModeEnum.Captured | gamepadMode)
|
||||
{
|
||||
velocity.x = direction.x * speed * (float)delta * 60;
|
||||
velocity.z = direction.z * speed * (float)delta * 60;
|
||||
velocity.X = direction.X * speed * (float)delta * 60;
|
||||
velocity.Z = direction.Z * speed * (float)delta * 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.x = Mathf.MoveToward(Velocity.x, 0, speed);
|
||||
velocity.z = Mathf.MoveToward(Velocity.z, 0, speed);
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, speed);
|
||||
velocity.Z = Mathf.MoveToward(Velocity.Z, 0, speed);
|
||||
}
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
@@ -68,10 +68,10 @@ public partial class player : CharacterBody3D
|
||||
Vector3 camRot = GetNode<Marker3D>("camera_center").RotationDegrees;
|
||||
if (@event is InputEventMouseMotion mouseMotion && Input.MouseMode == Input.MouseModeEnum.Captured)
|
||||
{
|
||||
camRot.y -= mouseMotion.Relative.x * camSensitivity;
|
||||
camRot.x -= mouseMotion.Relative.y * camSensitivity;
|
||||
camRot.Y -= mouseMotion.Relative.X * camSensitivity;
|
||||
camRot.X -= mouseMotion.Relative.Y * camSensitivity;
|
||||
}
|
||||
camRot.x = Mathf.Clamp(camRot.x, minCamPitch, maxCamPitch); //prevents camera from going endlessly around the player
|
||||
camRot.X = Mathf.Clamp(camRot.X, minCamPitch, maxCamPitch); //prevents camera from going endlessly around the player
|
||||
GetNode<Marker3D>("camera_center").RotationDegrees = camRot;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user