WIP: Spawn bullets on the server and sync them
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
[gd_scene load_steps=11 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"]
|
||||
@ -75,6 +75,10 @@ _data = {
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_toaij"]
|
||||
font_size = 70
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_1j1uq"]
|
||||
font_size = 100
|
||||
font_color = Color(0.756874, 0, 0.223924, 1)
|
||||
|
||||
[node name="CharacterPlaceholder" type="CharacterBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.799455, 0)
|
||||
collision_layer = 9
|
||||
@ -145,5 +149,12 @@ grow_vertical = 0
|
||||
text = "100"
|
||||
label_settings = SubResource("LabelSettings_toaij")
|
||||
|
||||
[node name="FPS" type="Label" parent="FirstPersonCameraMount/HUD"]
|
||||
layout_mode = 1
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_1j1uq")
|
||||
|
||||
[node name="ModelMount" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)
|
||||
|
@ -1,6 +1,6 @@
|
||||
extends Node3D
|
||||
|
||||
const SPEED = 2
|
||||
const SPEED = 200 # 200
|
||||
|
||||
@onready var mesh = $RigidBody3D/MeshInstance3D
|
||||
@onready var rigid_body_3d: RigidBody3D = $RigidBody3D
|
||||
@ -14,12 +14,15 @@ func _ready() -> void:
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var time_per_frame: float = 1 / Engine.get_frames_per_second()
|
||||
var distance: float = time_per_frame * SPEED * 1.5
|
||||
ray.target_position.z = distance
|
||||
position += transform.basis * Vector3(0, 0, SPEED) * delta
|
||||
rigid_body_3d.set_use_continuous_collision_detection(true)
|
||||
#ray.collision_mask = 1
|
||||
#ray.enabled = 1
|
||||
ray.target_position.z = SPEED / Engine.get_frames_per_second()
|
||||
if ray.is_colliding():
|
||||
print("I got hit")
|
||||
rigid_body_3d.visible = false
|
||||
particles.emitting = true
|
||||
#if ray.get_collider().is_in_group("body"):
|
||||
|
@ -36,7 +36,7 @@ properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 0
|
||||
properties/1/replication_mode = 2
|
||||
|
||||
[node name="Bullet" type="Node3D"]
|
||||
transform = Transform3D(20, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0)
|
||||
@ -71,7 +71,7 @@ shape = SubResource("CylinderShape3D_l3sdq")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.18476)
|
||||
material_override = SubResource("StandardMaterial3D_ynv38")
|
||||
emitting = false
|
||||
amount = 10
|
||||
amount = 100
|
||||
lifetime = 6.29
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
|
Reference in New Issue
Block a user