fixed some things, broke others. gotta figure out more collision issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=12 format=4 uid="uid://dqhltdnqyg8ni"]
|
||||
[gd_scene load_steps=13 format=4 uid="uid://dqhltdnqyg8ni"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_oj0f5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqytegxsmb5kg" path="res://assets/Models/bullet.transparency.png" id="2_0ks2n"]
|
||||
@@ -49,10 +49,8 @@ blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_dtlcm")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x6v7s"]
|
||||
transparency = 1
|
||||
blend_mode = 1
|
||||
albedo_color = Color(0.75476, 0.726851, 0.555583, 1)
|
||||
emission_enabled = true
|
||||
albedo_color = Color(0.26779, 0.26779, 0.26779, 1)
|
||||
metallic = 1.0
|
||||
emission = Color(0.944624, 0.755365, 0, 1)
|
||||
emission_energy_multiplier = 8.0
|
||||
|
||||
@@ -61,8 +59,8 @@ direction = Vector3(0, 0, 1)
|
||||
initial_velocity_min = 3.0
|
||||
initial_velocity_max = 5.0
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_jrtee"]
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_qy3jk"]
|
||||
size = Vector3(0.05, 0.05, 0.05)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ywt21"]
|
||||
transparency = 1
|
||||
@@ -72,20 +70,25 @@ emission_enabled = true
|
||||
emission = Color(0.737886, 0.150238, 0.0835467, 1)
|
||||
emission_energy_multiplier = 8.0
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_jrtee"]
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tqvit"]
|
||||
height = 1.53305
|
||||
height = 1.5
|
||||
radius = 0.055
|
||||
|
||||
[node name="Bullet" type="RigidBody3D"]
|
||||
top_level = true
|
||||
collision_layer = 32
|
||||
collision_mask = 109
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
mass = 0.1
|
||||
center_of_mass_mode = 1
|
||||
continuous_cd = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 10
|
||||
angular_damp = 100.0
|
||||
max_contacts_reported = 1
|
||||
script = ExtResource("1_oj0f5")
|
||||
|
||||
[node name="Cylinder" type="MeshInstance3D" parent="."]
|
||||
@@ -99,10 +102,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.718767)
|
||||
material_override = SubResource("StandardMaterial3D_x6v7s")
|
||||
cast_shadow = 0
|
||||
emitting = false
|
||||
amount = 20
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource("ParticleProcessMaterial_3wvag")
|
||||
draw_pass_1 = SubResource("BoxMesh_jrtee")
|
||||
draw_pass_1 = SubResource("BoxMesh_qy3jk")
|
||||
|
||||
[node name="GPUParticlesEnemy" type="GPUParticles3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.718767)
|
||||
@@ -123,4 +127,10 @@ stream = ExtResource("3_6j0l2")
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_tqvit")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.47877)
|
||||
target_position = Vector3(0, 0, -3)
|
||||
collision_mask = 105
|
||||
collide_with_areas = true
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
||||
@@ -301,7 +301,7 @@ tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0, 0.03, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 20.0, 0.0]
|
||||
"values": [0.0, 10.0, 0.0]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
|
||||
@@ -13,8 +13,8 @@ var player_velocity
|
||||
@onready var mesh = $Cylinder
|
||||
@onready var particles = $GPUParticles3D
|
||||
@onready var enemy_particles = $GPUParticlesEnemy
|
||||
@onready var gunbullet1 = $gunbullet1/Cylinder
|
||||
@onready var hit_indicator = $Audio/HitIndicator
|
||||
@onready var ray: RayCast3D = $RayCast3D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -27,6 +27,8 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta):
|
||||
|
||||
angular_velocity = Vector3(0,0,0)
|
||||
|
||||
distance_from_player = abs(self.global_position - player_position)
|
||||
|
||||
if distance_from_player.x > 2 or distance_from_player.y > 2 or distance_from_player.z > 2:
|
||||
@@ -35,36 +37,37 @@ func _physics_process(delta):
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
|
||||
|
||||
|
||||
if !body.is_in_group("player"):
|
||||
|
||||
if ray.is_colliding():
|
||||
print("ray collision")
|
||||
else:
|
||||
print("no ray collision")
|
||||
|
||||
mesh.visible = false
|
||||
|
||||
#bullethole effect
|
||||
#body.add_child(instance_bullethole)
|
||||
#instance_bullethole.global_transform.origin = global_position
|
||||
#if (abs(body.get_collision_normal().y) > 0.99):
|
||||
#instance_bullethole.look_at(body.get_collision_point() + body.get_collision_normal(), Vector3(0,0,1))
|
||||
#else:
|
||||
#instance_bullethole.look_at(body.get_collision_point() + body.get_collision_normal())
|
||||
|
||||
##move rigidbodies
|
||||
#if body.is_in_group("scene_rigidbody"):
|
||||
#body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
|
||||
if body.is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
body.breaking(current_velocity)
|
||||
|
||||
|
||||
if body.is_in_group("enemy_target"):
|
||||
print("enemy target hit")
|
||||
hit_indicator.play()
|
||||
enemy_particles.emitting = true
|
||||
body.hit(bullet_damage)
|
||||
if 1>2:#ray.is_colliding() and !ray.get_collider().is_in_group("player"):
|
||||
#Bullet Hole Effect
|
||||
ray.get_collider().add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
if (abs(ray.get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
|
||||
if body.is_in_group("switch"):
|
||||
body.hit()
|
||||
#Break Breakable Objects
|
||||
if ray.get_collider().is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
ray.get_collider().breaking(current_velocity)
|
||||
|
||||
#Hit Enemies
|
||||
if ray.get_collider().is_in_group("enemy_target"):
|
||||
hit_indicator.play()
|
||||
enemy_particles.emitting = true
|
||||
ray.get_collider().hit(bullet_damage)
|
||||
|
||||
#Switch Switches
|
||||
if ray.get_collider().is_in_group("switch"):
|
||||
ray.get_collider().hit()
|
||||
|
||||
#await get_tree().create_timer(1.0).timeout
|
||||
queue_free()
|
||||
|
||||
@@ -153,6 +153,7 @@ func fire(delta):
|
||||
instance_bullet.random_spread_amt = random_spread_amt
|
||||
instance_bullet.bullet_force_mod = bullet_force_mod
|
||||
instance_bullet.player_position = player.global_position
|
||||
instance_bullet.player_velocity = player.velocity
|
||||
instance_bullet.instance_bullethole = bullethole.instantiate()
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
player.recoil.add_recoil(recoil_amount)
|
||||
|
||||
Reference in New Issue
Block a user