Better bullet traces and raycast for hitscan

This commit is contained in:
2025-01-26 10:59:59 +01:00
parent 1c8458048c
commit 7da4a3d6bb
26 changed files with 1444 additions and 292 deletions

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://b10lpwfjgxds4"]
[gd_scene load_steps=9 format=3 uid="uid://b10lpwfjgxds4"]
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jc50w"]
radius = 0.3
@ -90,7 +91,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.609154, 0)
fov = 40.0
[node name="BulletStartingPoint" type="Node3D" parent="FirstPersonCameraMount"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -0.343115)
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -0.42185)
[node name="AimRay" type="RayCast3D" parent="FirstPersonCameraMount/BulletStartingPoint"]
target_position = Vector3(0, 0, 1000)
hit_from_inside = true
[node name="GunMount" type="Node3D" parent="FirstPersonCameraMount"]
@ -99,5 +104,31 @@ libraries = {
"": SubResource("AnimationLibrary_u1b6p")
}
[node name="HUD" type="Control" parent="FirstPersonCameraMount"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 8.0
offset_right = 8.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="TextureRect" type="TextureRect" parent="FirstPersonCameraMount/HUD"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -36.0
offset_top = -36.0
offset_right = 36.0
offset_bottom = 36.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_lsd7c")
[node name="ModelMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)