bullet collision seems fixed

This commit is contained in:
derek
2024-07-17 10:53:24 -05:00
parent 7ca4bc7750
commit 119d12b3da
10 changed files with 19 additions and 16 deletions

View File

@@ -54,7 +54,7 @@ _surfaces = [{
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_46pc3")
[node name="ammo_pickup" type="RigidBody3D" node_paths=PackedStringArray("collision_shape") groups=["pickup"]]
[node name="ammo_pickup" type="RigidBody3D" node_paths=PackedStringArray("collision_shape") groups=["magnet", "pickup"]]
collision_layer = 4
collision_mask = 6
script = ExtResource("1_sni3c")

View File

@@ -77,7 +77,6 @@ script = ExtResource("1_oj0f5")
[node name="gunbullet1" type="Node3D" parent="."]
transform = Transform3D(-2, 0, -3.01992e-07, 0, 2, 0, 3.01992e-07, 0, -2, 0, 0, 0)
metadata/_edit_lock_ = true
[node name="Cylinder" type="MeshInstance3D" parent="gunbullet1"]
transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, -2.57922e-08, 0, -0.313849)
@@ -87,8 +86,9 @@ skeleton = NodePath("")
[node name="RayCast3D" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1.70846, 0.00179088, 0.0114329, 0.492054)
target_position = Vector3(0, 0, -1.3)
target_position = Vector3(0, 0, -2)
collision_mask = 15
hit_from_inside = true
collide_with_areas = true
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]

View File

@@ -103,7 +103,7 @@ texture = ExtResource("8_kupqh")
script = ExtResource("7_pnp4a")
[node name="BulletRay" type="RayCast3D" parent="Head/Camera3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.226)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.0204881)
target_position = Vector3(0, 0, -200)
collision_mask = 7
collide_with_areas = true

View File

@@ -50,7 +50,7 @@ _surfaces = [{
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_dsuo5")
[node name="stamina_pickup" type="RigidBody3D" node_paths=PackedStringArray("collision_shape") groups=["pickup"]]
[node name="stamina_pickup" type="RigidBody3D" node_paths=PackedStringArray("collision_shape") groups=["magnet", "pickup"]]
collision_layer = 4
collision_mask = 6
script = ExtResource("1_1udac")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=90 format=3 uid="uid://bbxmgr0rva0nt"]
[ext_resource type="Script" path="res://scripts/WeaponManager.gd" id="1_i2kmm"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_i2kmm"]
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_dmgyw"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="2_fddwm"]
[ext_resource type="PackedScene" uid="uid://cnfc8rtk6l1d8" path="res://assets/crate1.tscn" id="3_0b5yv"]

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=54 format=3 uid="uid://dyop6vk3rgkkb"]
[ext_resource type="Script" path="res://scripts/WeaponManager.gd" id="1_orhgl"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_orhgl"]
[ext_resource type="Texture2D" uid="uid://dqs06ic3vjtwk" path="res://assets/Models/asphalt1.albedo.jpg" id="1_w4rag"]
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_6rjit"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="2_f87c2"]

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=28 format=3 uid="uid://boafwu4sqa6pq"]
[ext_resource type="Texture2D" uid="uid://dmsqpy4u3h023" path="res://assets/textures/dirt_ground_texture__tileable___2048x2048__by_fabooguy_d7aopi7-414w-2x.jpg" id="1_1xb3k"]
[ext_resource type="Script" path="res://scripts/WeaponManager.gd" id="1_5y2kg"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_5y2kg"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="1_cn03i"]
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_i74l1"]
[ext_resource type="PackedScene" uid="uid://b5eclfg0cmmal" path="res://assets/revolver_1.tscn" id="3_gih7i"]

View File

@@ -9,20 +9,19 @@ var ammo_current = [0,0]
var ammo_reserve = [0,0]
var guns_dict = {}
var current_gun_index
var money = 0
# Called when the node enters the scene tree for the first time.
func _ready():
#Set up starting guns and ammo
held_guns = [gun_1,gun_2]
var instance_gun = held_guns[0].instantiate()
var instance_gun_2 = held_guns[1].instantiate()
#set up ammo for starting guns
ammo_current[1] = instance_gun_2.max_ammo
ammo_reserve[1] = instance_gun_2.max_ammo * instance_gun_2.start_mags
ammo_current[0] = instance_gun.max_ammo
ammo_reserve[0] = instance_gun.max_ammo * instance_gun.start_mags
#spawn first gun
# Spawn first gun
current_gun_index = 0
gun_spawn(0)

View File

@@ -7,6 +7,7 @@ extends RigidBody3D
var rng = RandomNumberGenerator.new()
var rand_amt
var player
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -16,3 +17,8 @@ func _ready():
collision_shape.disabled = true
await get_tree().create_timer(1).timeout
self.queue_free()
func _physics_process(delta):
if player != null:
var float_direction = player.global_position - self.position
self.set_linear_velocity(float_direction * 10)

View File

@@ -247,10 +247,8 @@ func _on_pick_up_detection_body_entered(body):
func _on_pick_up_magnet_body_entered(body):
if body.is_in_group("pickup"):
body.collision_shape.disabled = true
var pickup_direction = self.global_position - body.global_position
body.linear_velocity += pickup_direction * 5
if body.is_in_group("pickup") and body.is_in_group("magnet"):
body.player = self
func weapon_tilt(input_x, delta):
if weapon_holder: