camera rotation sync

This commit is contained in:
Rendo 2025-12-03 16:12:57 +05:00
commit fb480e0a8b
3 changed files with 20 additions and 22 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=82 format=4 uid="uid://dpsr6ug3pkb40"] [gd_scene load_steps=83 format=4 uid="uid://dpsr6ug3pkb40"]
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"] [ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"] [ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
@ -7401,6 +7401,14 @@ _data = {
&"baked_sp_shoot_empty": SubResource("Animation_do7kw") &"baked_sp_shoot_empty": SubResource("Animation_do7kw")
} }
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_b2eak"]
properties/0/path = NodePath(".:rotation")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath("..:rotation")
properties/1/spawn = true
properties/1/replication_mode = 1
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g2els"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g2els"]
height = 1.2958984 height = 1.2958984
@ -7411,24 +7419,21 @@ font_size = 32
properties/0/path = NodePath(".:position") properties/0/path = NodePath(".:position")
properties/0/spawn = true properties/0/spawn = true
properties/0/replication_mode = 1 properties/0/replication_mode = 1
properties/1/path = NodePath(".:rotation") properties/1/path = NodePath(".:hp")
properties/1/spawn = true properties/1/spawn = true
properties/1/replication_mode = 1 properties/1/replication_mode = 1
properties/2/path = NodePath(".:hp") properties/2/path = NodePath(".:team")
properties/2/spawn = true properties/2/spawn = true
properties/2/replication_mode = 1 properties/2/replication_mode = 2
properties/3/path = NodePath(".:team") properties/3/path = NodePath(".:player_id")
properties/3/spawn = true properties/3/spawn = true
properties/3/replication_mode = 2 properties/3/replication_mode = 0
properties/4/path = NodePath(".:player_id") properties/4/path = NodePath(".:collision_layer")
properties/4/spawn = true properties/4/spawn = true
properties/4/replication_mode = 0 properties/4/replication_mode = 0
properties/5/path = NodePath(".:collision_layer") properties/5/path = NodePath(".:collision_mask")
properties/5/spawn = true properties/5/spawn = true
properties/5/replication_mode = 0 properties/5/replication_mode = 0
properties/6/path = NodePath(".:collision_mask")
properties/6/spawn = true
properties/6/replication_mode = 0
[sub_resource type="Curve" id="Curve_fbysy"] [sub_resource type="Curve" id="Curve_fbysy"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 2.5229826, 0.0, 0, 0] _data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 2.5229826, 0.0, 0, 0]
@ -8591,6 +8596,9 @@ script = ExtResource("4_smehm")
fov = 90.0 fov = 90.0
script = ExtResource("8_rwwcc") script = ExtResource("8_rwwcc")
[node name="CameraSync" type="MultiplayerSynchronizer" parent="Camera3D"]
replication_config = SubResource("SceneReplicationConfig_b2eak")
[node name="StandArea" type="Area3D" parent="."] [node name="StandArea" type="Area3D" parent="."]
collision_layer = 0 collision_layer = 0

View file

@ -8,6 +8,7 @@ class_name Player
set(id): set(id):
player_id = id player_id = id
$PlayerInput.set_multiplayer_authority(id) $PlayerInput.set_multiplayer_authority(id)
$Camera3D.set_multiplayer_authority(id)
var passived: bool = false var passived: bool = false

View file

@ -78,8 +78,6 @@ func switch(to: StringName, exit: bool = true):
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo) ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
switched_to.emit(current_state) switched_to.emit(current_state)
update_remotes.rpc(to,exit)
func return_to_previous(exit: bool = true): func return_to_previous(exit: bool = true):
if last_slot != "": if last_slot != "":
@ -87,15 +85,6 @@ func return_to_previous(exit: bool = true):
else: else:
switch("knife", exit) switch("knife", exit)
@rpc("authority","call_remote","reliable")
func update_remotes(to: StringName,exit: bool):
if current_state != null and exit:
current_state.exit()
current_state = slots[to]
current_state.enter()
switched_to.emit(current_state)
func drop_current(): func drop_current():
drop(current_state) drop(current_state)