raycast and fun
This commit is contained in:
parent
d4d1fb6463
commit
bb702a88f0
4 changed files with 92 additions and 30 deletions
|
@ -31,6 +31,14 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed(&"jump"): jumping = true
|
||||
#Touch
|
||||
if Input.is_action_just_pressed("touch"):
|
||||
print("touch")
|
||||
%AnimationPlayer.play("touch")
|
||||
#Look
|
||||
if %RayCast3D.is_colliding():
|
||||
print(%RayCast3D.get_collider())
|
||||
|
||||
if mouse_captured: _handle_joypad_camera_rotation(delta)
|
||||
velocity = _walk(delta) + _gravity(delta) + _jump(delta)
|
||||
move_and_slide()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://cdk6hwb4hi2wc"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://cdk6hwb4hi2wc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0c02p6ckmpdq" path="res://Player/player.gd" id="1_2f8j2"]
|
||||
[ext_resource type="Shader" uid="uid://c1ws5xtabtopc" path="res://psx_camera/psx_camera_shader.gdshader" id="2_4ntmi"]
|
||||
[ext_resource type="PackedScene" uid="uid://cp7wldb12tpm8" path="res://assets/graphics/models/hand.obj" id="3_btcbx"]
|
||||
[ext_resource type="Texture2D" uid="uid://1osrvxkcjngu" path="res://assets/graphics/textures/handtexture.png" id="4_gwnis"]
|
||||
|
||||
|
@ -9,29 +8,71 @@
|
|||
radius = 0.3
|
||||
height = 1.8
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_btcbx"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("2_4ntmi")
|
||||
shader_parameter/enable_fog = true
|
||||
shader_parameter/fog_color = Color(0.494245, 1.40181e-06, 2.40654e-07, 1)
|
||||
shader_parameter/noise_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/fog_distance = 100.0
|
||||
shader_parameter/fog_fade_range = 50.0
|
||||
shader_parameter/enable_noise = true
|
||||
shader_parameter/noise_time_fac = 4.0
|
||||
shader_parameter/enable_color_limitation = true
|
||||
shader_parameter/color_levels = 32
|
||||
shader_parameter/enable_dithering = true
|
||||
shader_parameter/dither_strength = 0.3
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_gwnis"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_gwnis"]
|
||||
material = SubResource("ShaderMaterial_btcbx")
|
||||
flip_faces = true
|
||||
size = Vector2(2, 2)
|
||||
[sub_resource type="Sky" id="Sky_k53q1"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_gwnis")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_fhl08"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_k53q1")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_k53q1"]
|
||||
albedo_texture = ExtResource("4_gwnis")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_k53q1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Camera/hand:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-0.439045, -2.29318, -0.10444)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gwnis"]
|
||||
resource_name = "touch"
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Camera/hand:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.0333333, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-0.439045, -2.29318, -0.10444), Vector3(-0.439045, -1.7, -1.91879)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fhl08"]
|
||||
resource_name = "touch"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Camera/hand:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.366667, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-0.439045, -2.29318, -0.10444), Vector3(-0.439, -1.7, -2.3), Vector3(-0.439045, -2.29318, -0.10444)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_fhl08"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_k53q1"),
|
||||
&"punch": SubResource("Animation_gwnis"),
|
||||
&"touch": SubResource("Animation_fhl08")
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_2f8j2")
|
||||
|
||||
|
@ -42,22 +83,25 @@ debug_color = Color(0.141176, 0.427451, 0.92549, 0.784314)
|
|||
|
||||
[node name="Camera" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.7, 0)
|
||||
environment = SubResource("Environment_fhl08")
|
||||
fov = 80.0
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Camera"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.800495)
|
||||
mesh = SubResource("QuadMesh_gwnis")
|
||||
|
||||
[node name="Hand" type="MeshInstance3D" parent="Camera"]
|
||||
transform = Transform3D(0.00214306, 0.0134455, 0.262051, 0.0219563, 0.286891, -0.0123296, -0.364886, 0.0173421, 0.000797189, 0.87108, -0.736241, -0.589995)
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="hand" parent="Camera" instance=ExtResource("3_btcbx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.599934, -1.7, -1.91879)
|
||||
visible = false
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.439045, -2.29318, -0.10444)
|
||||
|
||||
[node name="Cube" parent="Camera/hand" index="0"]
|
||||
transform = Transform3D(-0.103623, 0, 0.191626, 0, 0.289734, 0, -0.33763, 0, -0.0588126, 1.31232, 0.743218, 1.03127)
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_k53q1")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="Camera"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, -0.0119028, -0.999929, 0, 0.999929, -0.0119028, 0, -0.33609, 0)
|
||||
target_position = Vector3(0, -5, 0)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_fhl08")
|
||||
}
|
||||
|
||||
[editable path="Camera/hand"]
|
||||
|
|
|
@ -46,8 +46,13 @@ data = PackedVector3Array(0, 1, -1, 0, -1, -1, 0.1951, 1, -0.9808, 0.1951, 1, -0
|
|||
[node name="Player" parent="." instance=ExtResource("2_noarx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.44937, 4.1695, 1.32039)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="Player"]
|
||||
omni_range = 4096.0
|
||||
omni_attenuation = 0.14
|
||||
|
||||
[node name="joeb2" parent="." instance=ExtResource("1_a202f")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.53311, 2.3265, -3.3484)
|
||||
visible = false
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(565.25, 0, 0, 0, 1, 0, 0, 0, 374.765, 0, 0, 0)
|
||||
|
|
|
@ -49,3 +49,8 @@ jump={
|
|||
"events": [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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
touch={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(129, 17),"global_position":Vector2(138, 65),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue