LOOKS LIKE I FIXED THE BULLETS
needed to add raycast to target area collision layer
This commit is contained in:
@@ -82,7 +82,7 @@ margin = 0.001
|
||||
height = 1.5
|
||||
radius = 0.055
|
||||
|
||||
[node name="Bullet" type="RigidBody3D" node_paths=PackedStringArray("collision_shape")]
|
||||
[node name="Bullet" type="RigidBody3D"]
|
||||
top_level = true
|
||||
collision_layer = 128
|
||||
collision_mask = 233
|
||||
@@ -95,7 +95,6 @@ continuous_cd = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 3
|
||||
script = ExtResource("1_oj0f5")
|
||||
collision_shape = NodePath("BulletCollision")
|
||||
|
||||
[node name="Cylinder" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-2, -3.01992e-07, 0, 0, 0, -2, 3.01992e-07, -2, 0, 1.46364e-07, 0, 0.627698)
|
||||
@@ -135,8 +134,8 @@ shape = SubResource("CylinderShape3D_tqvit")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.781848)
|
||||
target_position = Vector3(0, 0, -3)
|
||||
collision_mask = 105
|
||||
target_position = Vector3(0, 0, -6)
|
||||
collision_mask = 233
|
||||
collide_with_areas = true
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=69 format=4 uid="uid://djr7vnr1hcx82"]
|
||||
[gd_scene load_steps=75 format=4 uid="uid://djr7vnr1hcx82"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/spider.gd" id="1_7e7fe"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmyn4eq2r12ue" path="res://assets/Models/spider1.albedoRAW.png" id="1_di6b8"]
|
||||
@@ -131,6 +131,50 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_bkwy8")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_h8f1e"]
|
||||
_data = [Vector2(0, 0), 0.0, 1.4, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_a61ob"]
|
||||
curve = SubResource("Curve_h8f1e")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_hewln"]
|
||||
min_value = -1.0
|
||||
_data = [Vector2(0, -1), 0.0, 2.8, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_td4g1"]
|
||||
curve = SubResource("Curve_hewln")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_jshtp"]
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 0.1
|
||||
direction = Vector3(-3, 0, 0)
|
||||
spread = 9.706
|
||||
initial_velocity_min = 3.0
|
||||
initial_velocity_max = 10.0
|
||||
gravity = Vector3(0, 0.5, 0)
|
||||
scale_min = 5.0
|
||||
scale_max = 5.0
|
||||
alpha_curve = SubResource("CurveTexture_a61ob")
|
||||
hue_variation_curve = SubResource("CurveTexture_td4g1")
|
||||
turbulence_enabled = true
|
||||
turbulence_noise_strength = 0.0
|
||||
turbulence_noise_scale = 0.655
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_crqaw"]
|
||||
transparency = 1
|
||||
blend_mode = 1
|
||||
shading_mode = 0
|
||||
albedo_color = Color(1, 1, 1, 0.14902)
|
||||
albedo_texture = ExtResource("14_alcfd")
|
||||
billboard_mode = 1
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_wcp5u"]
|
||||
material = SubResource("StandardMaterial3D_crqaw")
|
||||
size = Vector2(1, 1)
|
||||
orientation = 2
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_fovcl"]
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-0.328298, -0.27793, -0.600544, 0.59341, 0.471561, 0.924056),
|
||||
@@ -368,9 +412,6 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_e6w2f")
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_53sks"]
|
||||
radius = 0.201929
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_ae424"]
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-0.0791332, -0.435205, -0.0791332, 0.158266, 0.426464, 0.158266),
|
||||
@@ -802,6 +843,16 @@ mesh = SubResource("ArrayMesh_ncgm4")
|
||||
skeleton = NodePath("")
|
||||
surface_material_override/2 = SubResource("StandardMaterial3D_1eb8w")
|
||||
|
||||
[node name="fire_smoke" type="GPUParticles3D" parent="TurretLook/Turret"]
|
||||
transform = Transform3D(-0.175298, 0, -0.984515, 0, 1, 0, 0.984515, 0, -0.175298, 0.127458, 0, -0.574557)
|
||||
emitting = false
|
||||
amount = 500
|
||||
lifetime = 4.0
|
||||
explosiveness = 1.0
|
||||
fixed_fps = 60
|
||||
process_material = SubResource("ParticleProcessMaterial_jshtp")
|
||||
draw_pass_1 = SubResource("PlaneMesh_wcp5u")
|
||||
|
||||
[node name="Barrel1" type="RayCast3D" parent="TurretLook/Turret"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.122326, -0.000110626, -0.580876)
|
||||
target_position = Vector3(0, 0, -1)
|
||||
@@ -866,10 +917,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.03709, 0)
|
||||
mesh = SubResource("ArrayMesh_2v4nl")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.27309, 0.440626)
|
||||
shape = SubResource("SphereShape3D_53sks")
|
||||
|
||||
[node name="leg1" type="MeshInstance3D" parent="body"]
|
||||
transform = Transform3D(-0.639212, -0.650131, -0.410778, -0.71307, 0.701093, -4.47035e-08, 0.287994, 0.292914, -0.911736, 0.305074, -0.206463, -0.323723)
|
||||
mesh = SubResource("ArrayMesh_xc2wd")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=41 format=4 uid="uid://dqwkal3t4gf2p"]
|
||||
[gd_scene load_steps=45 format=4 uid="uid://dqwkal3t4gf2p"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/blunderbus.gd" id="1_w46uw"]
|
||||
[ext_resource type="PackedScene" uid="uid://717hhehp83k8" path="res://assets/shotgun_pellet.tscn" id="2_544x3"]
|
||||
@@ -227,12 +227,12 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_3f3hx")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_rmltw"]
|
||||
[sub_resource type="Curve" id="Curve_h8f1e"]
|
||||
_data = [Vector2(0, 0), 0.0, 1.4, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_a61ob"]
|
||||
curve = SubResource("Curve_rmltw")
|
||||
curve = SubResource("Curve_h8f1e")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_0viso"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
@@ -240,13 +240,13 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_qejk1"]
|
||||
gradient = SubResource("Gradient_0viso")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_6gtuk"]
|
||||
[sub_resource type="Curve" id="Curve_hewln"]
|
||||
min_value = -1.0
|
||||
_data = [Vector2(0, -1), 0.0, 2.8, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_td4g1"]
|
||||
curve = SubResource("Curve_6gtuk")
|
||||
curve = SubResource("Curve_hewln")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xmjr3"]
|
||||
particle_flag_rotate_y = true
|
||||
@@ -263,7 +263,7 @@ turbulence_enabled = true
|
||||
turbulence_noise_strength = 0.0
|
||||
turbulence_noise_scale = 0.5
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_crqaw"]
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x7w80"]
|
||||
transparency = 1
|
||||
blend_mode = 1
|
||||
shading_mode = 0
|
||||
@@ -272,10 +272,25 @@ albedo_texture = ExtResource("9_fldbw")
|
||||
billboard_mode = 1
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_756l0"]
|
||||
material = SubResource("StandardMaterial3D_crqaw")
|
||||
material = SubResource("StandardMaterial3D_x7w80")
|
||||
size = Vector2(1, 1)
|
||||
orientation = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_rmltw"]
|
||||
_data = [Vector2(0, 0), 0.0, 1.4, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_gllo2"]
|
||||
curve = SubResource("Curve_rmltw")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_6gtuk"]
|
||||
min_value = -1.0
|
||||
_data = [Vector2(0, -1), 0.0, 2.8, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_qa12x"]
|
||||
curve = SubResource("Curve_6gtuk")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_ay36f"]
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 0.1
|
||||
@@ -286,8 +301,8 @@ initial_velocity_max = 10.0
|
||||
gravity = Vector3(0, 0.5, 0)
|
||||
scale_min = 5.0
|
||||
scale_max = 5.0
|
||||
alpha_curve = SubResource("CurveTexture_a61ob")
|
||||
hue_variation_curve = SubResource("CurveTexture_td4g1")
|
||||
alpha_curve = SubResource("CurveTexture_gllo2")
|
||||
hue_variation_curve = SubResource("CurveTexture_qa12x")
|
||||
turbulence_enabled = true
|
||||
turbulence_noise_strength = 0.0
|
||||
turbulence_noise_scale = 0.655
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@export var collision_shape : Node
|
||||
|
||||
var bullet_speed
|
||||
var bullet_drop
|
||||
var random_spread_amt
|
||||
@@ -12,7 +10,6 @@ var distance_from_player
|
||||
var player_position
|
||||
var player_velocity
|
||||
var bullet_active = true
|
||||
var bullet_target : Node
|
||||
|
||||
@onready var mesh = $Cylinder
|
||||
@onready var particles = $GPUParticles3D
|
||||
@@ -20,11 +17,11 @@ var bullet_target : Node
|
||||
@onready var hit_indicator = $Audio/HitIndicator
|
||||
@onready var ray: RayCast3D = $RayCast3D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
visible = false
|
||||
if bullet_target == null:
|
||||
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed) + player_velocity
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -32,15 +29,11 @@ func _physics_process(delta):
|
||||
|
||||
angular_velocity = Vector3(0,0,0)
|
||||
|
||||
distance_from_player = self.global_position.distance_to(player_position)
|
||||
distance_from_player = abs(self.global_position - player_position)
|
||||
|
||||
if distance_from_player > 1.5:
|
||||
if distance_from_player.length() > 1.5:
|
||||
visible = true
|
||||
|
||||
if bullet_target != null:
|
||||
linear_velocity = transform.basis * Vector3(0, 0, -bullet_speed)
|
||||
look_at(bullet_target.global_position)
|
||||
|
||||
if ray.is_colliding():
|
||||
var body = ray.get_collider()
|
||||
if body != null and !body.is_in_group("player"):
|
||||
@@ -73,39 +66,12 @@ func _physics_process(delta):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
ray.get_collider().breaking(current_velocity)
|
||||
|
||||
despawn()
|
||||
queue_free()
|
||||
|
||||
#func _on_body_entered(body: Node) -> void:
|
||||
#
|
||||
#if !body.is_in_group("player"):
|
||||
#
|
||||
#ray.enabled = false
|
||||
#
|
||||
#if ray.is_colliding():
|
||||
#var ray_body = ray.get_collider()
|
||||
#if ray_body != null:
|
||||
##bullethole effect
|
||||
#ray_body.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()
|
||||
#
|
||||
###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)
|
||||
#despawn()
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
if !body.is_in_group("player"):
|
||||
await get_tree().create_timer(.1).timeout
|
||||
mesh.visible = false
|
||||
|
||||
func despawn():
|
||||
#visible = false
|
||||
#collision_shape.disabled = true
|
||||
#await get_tree().create_timer(1).timeout
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user