#Godot 4.1.3 Networking code seems perfect but clients have no authority over their characters

1 messages · Page 1 of 1 (latest)

humble finch
#

CHARACTER MOVEMENT SCRIPT



@export var speed = 700
@export var camera_slowness = 7000

@onready var y_pivot = get_node("y_Pivot")
@onready var x_pivot = get_node("y_Pivot/x_Pivot2")
@onready var camera = $y_Pivot/x_Pivot2/Camera3D


func _ready():
    set_multiplayer_authority(name.to_int())
    camera.current = is_multiplayer_authority()


func _physics_process(delta):
    if not is_multiplayer_authority(): return
    var foward_back_direction = ((global_position - get_node("FollowNode").global_position) * speed) * delta
    var left_right_direction = ((global_position - get_node("FollowNode2").global_position) * speed) * delta
    if Input.is_action_pressed("walk forward"):
        apply_central_force(-foward_back_direction)
    if Input.is_action_pressed("walk back"):
        apply_central_force(foward_back_direction)
    if Input.is_action_pressed("walk right"):
        apply_central_force(left_right_direction)
    if Input.is_action_pressed("walk left"):
        apply_central_force(-left_right_direction)


func _input(event):
    if not is_multiplayer_authority(): return
    if event is InputEventMouseMotion and Input.is_action_pressed("pan_cam"):
        event.velocity /= camera_slowness
        y_pivot.rotation.y -= event.velocity.x
        x_pivot.rotation.x -= event.velocity.y
#

The clients connect to the server, and their characters even appear on the servers screen. But the clients have no authority over their character; nor can they see through their own cameras. I would love it if someone could help megdskull

humble finch
#

Godot 4.1 Networking code seems perfect but clients have no authority over their characters

humble finch
#

Godot 4.1.3 Networking code seems perfect but clients have no authority over their characters