gd: inputs for dash
This commit is contained in:
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://boasm0g587eov"
|
||||
path.s3tc="res://.godot/imported/texture_01.png-9deee4bf2e81814eb5c9325f2657f8c8.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/texture_01.png-9deee4bf2e81814eb5c9325f2657f8c8.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/GridTexture/Dark/texture_01.png"
|
||||
dest_files=["res://.godot/imported/texture_01.png-9deee4bf2e81814eb5c9325f2657f8c8.s3tc.ctex", "res://.godot/imported/texture_01.png-9deee4bf2e81814eb5c9325f2657f8c8.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_01.png-9deee4bf2e81814eb5c9325f2657f8c8.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://3e1klega6uye"
|
||||
path.s3tc="res://.godot/imported/texture_01.png-ae5afc2ae737d1e792f0b8a0a5af4d3f.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/texture_01.png-ae5afc2ae737d1e792f0b8a0a5af4d3f.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/GridTexture/Green/texture_01.png"
|
||||
dest_files=["res://.godot/imported/texture_01.png-ae5afc2ae737d1e792f0b8a0a5af4d3f.s3tc.ctex", "res://.godot/imported/texture_01.png-ae5afc2ae737d1e792f0b8a0a5af4d3f.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_01.png-ae5afc2ae737d1e792f0b8a0a5af4d3f.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0t6ie0fkv2op"
|
||||
path.s3tc="res://.godot/imported/texture_01.png-1dcf4b27bd12b1fd18e6c870b30bb902.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/texture_01.png-1dcf4b27bd12b1fd18e6c870b30bb902.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/GridTexture/Light/texture_01.png"
|
||||
dest_files=["res://.godot/imported/texture_01.png-1dcf4b27bd12b1fd18e6c870b30bb902.s3tc.ctex", "res://.godot/imported/texture_01.png-1dcf4b27bd12b1fd18e6c870b30bb902.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_01.png-1dcf4b27bd12b1fd18e6c870b30bb902.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://t10lfkxrg7ay"
|
||||
path.s3tc="res://.godot/imported/texture_01.png-2d26b48d2dec4e4e9eea4b1c047417c0.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/texture_01.png-2d26b48d2dec4e4e9eea4b1c047417c0.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/GridTexture/Orange/texture_01.png"
|
||||
dest_files=["res://.godot/imported/texture_01.png-2d26b48d2dec4e4e9eea4b1c047417c0.s3tc.ctex", "res://.godot/imported/texture_01.png-2d26b48d2dec4e4e9eea4b1c047417c0.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_01.png-2d26b48d2dec4e4e9eea4b1c047417c0.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dgix86l87u86s"
|
||||
path.s3tc="res://.godot/imported/texture_01.png-a7949be0e945f82b88e838fe48a6f350.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/texture_01.png-a7949be0e945f82b88e838fe48a6f350.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/GridTexture/Red/texture_01.png"
|
||||
dest_files=["res://.godot/imported/texture_01.png-a7949be0e945f82b88e838fe48a6f350.s3tc.ctex", "res://.godot/imported/texture_01.png-a7949be0e945f82b88e838fe48a6f350.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_01.png-a7949be0e945f82b88e838fe48a6f350.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://woq2hudxhckr"
|
||||
path.s3tc="res://.godot/imported/Gabor 1 - 512x512.png-35241d8f4670c338b8c89a271f5b5891.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/Gabor 1 - 512x512.png-35241d8f4670c338b8c89a271f5b5891.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Assets/Textures/PerlinNoise/Gabor 1 - 512x512.png"
|
||||
dest_files=["res://.godot/imported/Gabor 1 - 512x512.png-35241d8f4670c338b8c89a271f5b5891.s3tc.ctex", "res://.godot/imported/Gabor 1 - 512x512.png-35241d8f4670c338b8c89a271f5b5891.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/Gabor 1 - 512x512.png-35241d8f4670c338b8c89a271f5b5891.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://lp2pt8mtj7ty"
|
||||
path.s3tc="res://.godot/imported/kenney-green-checkerboar-cc0.png-2ce8609a39a655125c8e037014f6f2db.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/kenney-green-checkerboar-cc0.png-2ce8609a39a655125c8e037014f6f2db.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"imported_formats": ["etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player_controller/Examples/MovementTestbed/Hills/kenney-green-checkerboar-cc0.png"
|
||||
dest_files=["res://.godot/imported/kenney-green-checkerboar-cc0.png-2ce8609a39a655125c8e037014f6f2db.s3tc.ctex", "res://.godot/imported/kenney-green-checkerboar-cc0.png-2ce8609a39a655125c8e037014f6f2db.etc2.ctex"]
|
||||
dest_files=["res://.godot/imported/kenney-green-checkerboar-cc0.png-2ce8609a39a655125c8e037014f6f2db.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
@ -1,14 +1,19 @@
|
||||
[gd_scene load_steps=30 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=34 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||
[ext_resource type="Material" uid="uid://dtq8i1ka1f2pn" path="res://player_controller/Assets/Materials/Health/CameraVignette.tres" id="2_6hee7"]
|
||||
[ext_resource type="Material" uid="uid://nyh5tn1yoxeu" path="res://player_controller/Assets/Materials/Health/CameraDistortion.tres" id="3_mxh1y"]
|
||||
[ext_resource type="Shader" uid="uid://btw6vsb6sa7sn" path="res://player_controller/Shaders/Blur.gdshader" id="4_jyscr"]
|
||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/walk_mode/rotate_y.tres" id="4_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://systems/inputs/walk_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
||||
[ext_resource type="Script" uid="uid://dv7v1ywmbvvcd" path="res://player_controller/Scripts/HealthSystem.cs" id="5_umw0l"]
|
||||
[ext_resource type="Script" uid="uid://vuq8rjq3vegn" path="res://player_controller/Scripts/Stamina.cs" id="6_lxtc4"]
|
||||
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://player_controller/Scripts/StairsSystem.cs" id="7_bmt5a"]
|
||||
[ext_resource type="Resource" uid="uid://dgfww8118d8gj" path="res://systems/inputs/walk_mode/aim.tres" id="7_cresl"]
|
||||
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/walk_mode/aim_release.tres" id="8_lhb11"]
|
||||
[ext_resource type="Script" uid="uid://dd1yrt7eiiyf4" path="res://player_controller/Scripts/CapsuleCollider.cs" id="8_lmtjd"]
|
||||
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle_system.tscn" id="8_qu4wy"]
|
||||
[ext_resource type="Resource" uid="uid://7wm8ywvujwf" path="res://systems/inputs/walk_mode/aim_cancel.tres" id="9_5p2qc"]
|
||||
[ext_resource type="Script" uid="uid://bt0xv2q8iv1vn" path="res://player_controller/Scripts/Gravity.cs" id="9_lsueh"]
|
||||
[ext_resource type="Script" uid="uid://dwoppk8j5fxeg" path="res://player_controller/Scripts/DashSystem.cs" id="9_qu4wy"]
|
||||
[ext_resource type="Script" uid="uid://g8idirw62qe0" path="res://player_controller/Scripts/Bobbing.cs" id="10_7wk1w"]
|
||||
@ -18,7 +23,6 @@
|
||||
[ext_resource type="Script" uid="uid://b5nk6ntlps3x0" path="res://systems/inputs/input_system.gd" id="16_v31n3"]
|
||||
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/walk_mode/move.tres" id="17_h6vvl"]
|
||||
[ext_resource type="Resource" uid="uid://dijkqkltwkrfe" path="res://systems/inputs/walk_mode/walk_mode.tres" id="18_sik0q"]
|
||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/walk_mode/rotate_y.tres" id="18_yvnfg"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||
|
||||
@ -123,7 +127,16 @@ _data = {
|
||||
script = ExtResource("1_poq2x")
|
||||
WalkSpeed = 10.0
|
||||
SprintSpeed = 15.0
|
||||
ControllerSensitivity = 30.0
|
||||
|
||||
[node name="InputController" type="Node3D" parent="."]
|
||||
script = ExtResource("16_v31n3")
|
||||
walk_mode = ExtResource("18_sik0q")
|
||||
move = ExtResource("17_h6vvl")
|
||||
rotate_y = ExtResource("4_rxwoh")
|
||||
rotate_floorplane = ExtResource("5_4u7i3")
|
||||
aim_pressed = ExtResource("7_cresl")
|
||||
aim_released = ExtResource("8_lhb11")
|
||||
aim_canceled = ExtResource("9_5p2qc")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
@ -196,6 +209,8 @@ target_position = Vector3(0, -0.55, 0)
|
||||
target_position = Vector3(0, -0.75, 0)
|
||||
|
||||
[node name="MantleSystem" parent="." instance=ExtResource("8_qu4wy")]
|
||||
MantleEndLocationDistanceFromWall = 1.0
|
||||
MantleHeightCastStart = 2.0
|
||||
|
||||
[node name="DashSystem" type="Node3D" parent="."]
|
||||
script = ExtResource("9_qu4wy")
|
||||
@ -213,6 +228,8 @@ mesh = SubResource("SphereMesh_qu4wy")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_v31n3")
|
||||
|
||||
[node name="MantleSystem" parent="DashSystem" instance=ExtResource("8_qu4wy")]
|
||||
MantleEndLocationDistanceFromWall = 1.0
|
||||
MantleHeightCastStart = 2.0
|
||||
|
||||
[node name="StairsSystem" type="Node3D" parent="."]
|
||||
script = ExtResource("7_bmt5a")
|
||||
@ -254,8 +271,9 @@ target_position = Vector3(0, 1, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.296, 1.4, 0)
|
||||
target_position = Vector3(0, 1, 0)
|
||||
|
||||
[node name="InputController" type="Node3D" parent="."]
|
||||
script = ExtResource("16_v31n3")
|
||||
move = ExtResource("17_h6vvl")
|
||||
rotate_player = ExtResource("18_yvnfg")
|
||||
walk_mode = ExtResource("18_sik0q")
|
||||
[connection signal="input_aim_canceled" from="InputController" to="." method="OnInputAimCanceled"]
|
||||
[connection signal="input_aim_pressed" from="InputController" to="." method="OnInputAimPressed"]
|
||||
[connection signal="input_aim_released" from="InputController" to="." method="OnInputAimReleased"]
|
||||
[connection signal="input_move" from="InputController" to="." method="OnInputMove"]
|
||||
[connection signal="input_rotate_floorplane" from="InputController" to="." method="OnInputRotateFloorplane"]
|
||||
[connection signal="input_rotate_y" from="InputController" to="." method="OnInputRotateY"]
|
||||
|
@ -56,6 +56,45 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
private const int NumOfHeadCollisionDetectors = 4;
|
||||
private RayCast3D[] _headCollisionDetectors;
|
||||
|
||||
private Vector3 _inputMove = Vector3.Zero;
|
||||
private float _inputRotateY = 0.0f;
|
||||
private float _inputRotateFloorplane = 0.0f;
|
||||
|
||||
private bool _isAiming = false;
|
||||
|
||||
public void OnInputMove(Vector3 value)
|
||||
{
|
||||
_inputMove = value;
|
||||
}
|
||||
|
||||
public void OnInputRotateY(float value)
|
||||
{
|
||||
_inputRotateY = value;
|
||||
}
|
||||
|
||||
public void OnInputRotateFloorplane(float value)
|
||||
{
|
||||
_inputRotateFloorplane = value;
|
||||
}
|
||||
|
||||
public void OnInputAimPressed()
|
||||
{
|
||||
_isAiming = true;
|
||||
GD.Print("Aim pressed");
|
||||
}
|
||||
public void OnInputAimReleased()
|
||||
{
|
||||
_isAiming = false;
|
||||
GD.Print("Aim released");
|
||||
}
|
||||
public void OnInputAimCanceled()
|
||||
{
|
||||
_isAiming = false;
|
||||
GD.Print("Aim canceled");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@ -286,18 +325,16 @@ public partial class PlayerController : CharacterBody3D
|
||||
_currentSpeed = SprintSpeed;
|
||||
}
|
||||
|
||||
Vector2 inputLookDir = Input.GetVector("look_left", "look_right", "look_up", "look_down");
|
||||
// Vector2 inputLookDir = Input.GetVector("look_left", "look_right", "look_up", "look_down");
|
||||
Vector2 inputLookDir = new Vector2(_inputRotateY, _inputRotateFloorplane);
|
||||
Mouse.LookAround(-1 * ControllerSensitivity * inputLookDir);
|
||||
|
||||
// Get the input direction
|
||||
Vector2 inputDir = Input.GetVector("left", "right", "up", "down");
|
||||
|
||||
|
||||
// Basis is a 3x4 matrix. It contains information about scaling and rotation of head.
|
||||
// By multiplying our Vector3 by this matrix we're doing multiple things:
|
||||
// a) We start to operate in global space;
|
||||
// b) We're applying to Vector3 the current rotation of "head" object;
|
||||
// c) We're applying to Vector3 the current scaling of "head" object;
|
||||
Vector3 direction = (Head.Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
|
||||
Vector3 direction = Head.Transform.Basis * _inputMove;
|
||||
|
||||
if (isPlayerDead)
|
||||
{
|
||||
|
Reference in New Issue
Block a user