tweaks and improvements to the tracking pistol
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=23 format=3 uid="uid://dslxb3psx30vp"]
|
[gd_scene load_steps=24 format=3 uid="uid://dslxb3psx30vp"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://svrb3n31mkag" path="res://assets/Models/gun.blend" id="1_frekg"]
|
[ext_resource type="PackedScene" uid="uid://svrb3n31mkag" path="res://assets/Models/gun.blend" id="1_frekg"]
|
||||||
[ext_resource type="Script" path="res://scripts/trackerGun.gd" id="2_ieev5"]
|
[ext_resource type="Script" path="res://scripts/trackerGun.gd" id="2_ieev5"]
|
||||||
@@ -356,6 +356,61 @@ tracks/2/keys = {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_lhlkm"]
|
||||||
|
resource_name = "remove_tracker"
|
||||||
|
length = 0.35
|
||||||
|
step = 0.01
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("gun:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.16, 0.24, 0.35),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, -0.000397999, 0), Vector3(0, -0.0215431, 0), Vector3(0, 0.116845, 0), Vector3(0, -0.000397999, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("gun:rotation")
|
||||||
|
tracks/1/interp = 2
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.16, 0.24, 0.35),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, -1.5708, 0), Vector3(1.04543e-06, -1.5708, 0.288695), Vector3(-2.69979e-06, -1.5708, -0.841737), Vector3(0, -1.5708, 0)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("gun/slide:position")
|
||||||
|
tracks/2/interp = 2
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(),
|
||||||
|
"transitions": PackedFloat32Array(),
|
||||||
|
"update": 0,
|
||||||
|
"values": []
|
||||||
|
}
|
||||||
|
tracks/3/type = "method"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath(".")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(0.24),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"remove_tracker"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vkrtt"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vkrtt"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_urfns"),
|
"RESET": SubResource("Animation_urfns"),
|
||||||
@@ -363,6 +418,7 @@ _data = {
|
|||||||
"fire_tracker": SubResource("Animation_h3q6j"),
|
"fire_tracker": SubResource("Animation_h3q6j"),
|
||||||
"inspect": SubResource("Animation_cifop"),
|
"inspect": SubResource("Animation_cifop"),
|
||||||
"reload": SubResource("Animation_svhrs"),
|
"reload": SubResource("Animation_svhrs"),
|
||||||
|
"remove_tracker": SubResource("Animation_lhlkm"),
|
||||||
"shoot": SubResource("Animation_bsc1a"),
|
"shoot": SubResource("Animation_bsc1a"),
|
||||||
"sprint": SubResource("Animation_tikvk"),
|
"sprint": SubResource("Animation_tikvk"),
|
||||||
"swap_in": SubResource("Animation_7422e"),
|
"swap_in": SubResource("Animation_7422e"),
|
||||||
|
|||||||
@@ -894,6 +894,14 @@ shape = SubResource("SphereShape3D_n7n6o")
|
|||||||
visible = false
|
visible = false
|
||||||
mesh = SubResource("ArrayMesh_v85cv")
|
mesh = SubResource("ArrayMesh_v85cv")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0258179, 1.03281, 0.00894165)
|
||||||
|
shape = SubResource("BoxShape3D_xxx55")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.31018, 0.440626)
|
||||||
|
shape = SubResource("SphereShape3D_53sks")
|
||||||
|
|
||||||
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
|
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
|
||||||
path_height_offset = 0.5
|
path_height_offset = 0.5
|
||||||
avoidance_enabled = true
|
avoidance_enabled = true
|
||||||
@@ -921,14 +929,6 @@ one_shot = true
|
|||||||
stream = ExtResource("10_2qmhc")
|
stream = ExtResource("10_2qmhc")
|
||||||
volume_db = 10.0
|
volume_db = 10.0
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0258179, 1.03281, 0.00894165)
|
|
||||||
shape = SubResource("BoxShape3D_xxx55")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.31018, 0.440626)
|
|
||||||
shape = SubResource("SphereShape3D_53sks")
|
|
||||||
|
|
||||||
[connection signal="body_entered" from="body/Area3D" to="body/Area3D" method="_on_body_entered"]
|
[connection signal="body_entered" from="body/Area3D" to="body/Area3D" method="_on_body_entered"]
|
||||||
[connection signal="body_part_hit" from="body/Area3D" to="." method="_on_area_3d_body_part_hit"]
|
[connection signal="body_part_hit" from="body/Area3D" to="." method="_on_area_3d_body_part_hit"]
|
||||||
[connection signal="timeout" from="Timers/prefire_timer" to="." method="_on_prefire_timer_timeout"]
|
[connection signal="timeout" from="Timers/prefire_timer" to="." method="_on_prefire_timer_timeout"]
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ height = 0.2
|
|||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fmyhe"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fmyhe"]
|
||||||
transparency = 1
|
transparency = 1
|
||||||
blend_mode = 1
|
blend_mode = 1
|
||||||
emission_enabled = true
|
shading_mode = 0
|
||||||
emission = Color(0, 0.745098, 0, 1)
|
albedo_color = Color(0, 1, 0, 0.498039)
|
||||||
emission_energy_multiplier = 10.0
|
|
||||||
|
|
||||||
[sub_resource type="CylinderMesh" id="CylinderMesh_0f8ut"]
|
[sub_resource type="CylinderMesh" id="CylinderMesh_0f8ut"]
|
||||||
top_radius = 0.1
|
top_radius = 0.1
|
||||||
@@ -41,7 +40,47 @@ tracks/1/keys = {
|
|||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [true]
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Sphere:scale")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_cu36u"]
|
||||||
|
resource_name = "check"
|
||||||
|
step = 0.01
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("MeshHandle/Mesh:visible")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("MeshHandle:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 20, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_rkem3"]
|
[sub_resource type="Animation" id="Animation_rkem3"]
|
||||||
@@ -102,33 +141,17 @@ tracks/1/keys = {
|
|||||||
"method": &"queue_free"
|
"method": &"queue_free"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
[sub_resource type="Animation" id="Animation_cu36u"]
|
tracks/2/imported = false
|
||||||
resource_name = "check"
|
tracks/2/enabled = true
|
||||||
step = 0.01
|
tracks/2/path = NodePath("Sphere:scale")
|
||||||
tracks/0/type = "value"
|
tracks/2/interp = 2
|
||||||
tracks/0/imported = false
|
tracks/2/loop_wrap = true
|
||||||
tracks/0/enabled = true
|
tracks/2/keys = {
|
||||||
tracks/0/path = NodePath("MeshHandle/Mesh:visible")
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
tracks/0/interp = 1
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [false]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("MeshHandle:position")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0, 20, 0)]
|
"values": [Vector3(1, 1, 1), Vector3(0, 0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_776o6"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_776o6"]
|
||||||
@@ -151,6 +174,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_fmyhe")
|
|||||||
|
|
||||||
[node name="Mesh" type="MeshInstance3D" parent="MeshHandle"]
|
[node name="Mesh" type="MeshInstance3D" parent="MeshHandle"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
visible = false
|
||||||
mesh = SubResource("CylinderMesh_0f8ut")
|
mesh = SubResource("CylinderMesh_0f8ut")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_fmyhe")
|
surface_material_override/0 = SubResource("StandardMaterial3D_fmyhe")
|
||||||
|
|||||||
@@ -133,8 +133,11 @@ func fire():
|
|||||||
func tracker_checker(_delta):
|
func tracker_checker(_delta):
|
||||||
if player.bullet_ray.is_colliding():
|
if player.bullet_ray.is_colliding():
|
||||||
var spawn_loc = player.bullet_ray.get_collision_point()
|
var spawn_loc = player.bullet_ray.get_collision_point()
|
||||||
|
var distance_to_point = self.global_position.distance_to(spawn_loc)
|
||||||
|
var scale_adjusted = distance_to_point/5
|
||||||
tracker_check_mesh.global_transform.origin = spawn_loc
|
tracker_check_mesh.global_transform.origin = spawn_loc
|
||||||
tracker_check_mesh.global_rotation = Vector3(0,0,0)
|
tracker_check_mesh.global_rotation = Vector3(0,0,0)
|
||||||
|
tracker_check_mesh.scale = Vector3(scale_adjusted,scale_adjusted,scale_adjusted)
|
||||||
if check_track == true and Input.is_action_just_released("shoot"):
|
if check_track == true and Input.is_action_just_released("shoot"):
|
||||||
fire_tracker()
|
fire_tracker()
|
||||||
check_track = false
|
check_track = false
|
||||||
@@ -155,10 +158,11 @@ func fire_tracker():
|
|||||||
func remove_tracker():
|
func remove_tracker():
|
||||||
if tracker != null:
|
if tracker != null:
|
||||||
tracker.remove()
|
tracker.remove()
|
||||||
|
tracker = null
|
||||||
|
|
||||||
func reload():
|
func reload():
|
||||||
if tracker != null:
|
if tracker != null:
|
||||||
remove_tracker()
|
anim_player.play("remove_tracker")
|
||||||
else:
|
else:
|
||||||
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
||||||
anim_player.play("reload")
|
anim_player.play("reload")
|
||||||
|
|||||||
Reference in New Issue
Block a user