This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Good evening, I want to transmit head rotation to the server, but when I try to do this, nothing comes out, other players do not see your turn, help me please

server player script

extends Spatial

onready var head = $Head
onready var head_x = $Head/HeadXRotation

remote func updateplayer(transform):
rpc
unreliable("updateremoteplayer", transform)

remote func updateremoteheadrotation(headrotationx, headrotation):
rpcunreliable("updateheadrotation", head.rotationdegrees.y, headx.rotationdegrees.x)

Client player script

func input(event):
if is
networkmaster():
if not note
picked:
if event is InputEventMouseMotion:
head.rotationdegrees.y += sensitivity * event.relative.x
head
x.rotationdegrees.x += sensitivity * event.relative.y
head
x.rotationdegrees.x = clamp(headx.rotationdegrees.x, -89, 89)
elif event is InputEventKey:
if Input.is
actionjustpressed("flashlight") and event.pressed and progressflash > 0:
timer2 = 0
flashlightlight.visible = !flashlightlight.visible
flashlightsound.play()
elif event.scancode == KEY
SHIFT:
isshiftpressed = event.pressed
elif Input.isactionjustpressed("duck") and event.pressed:
is
crouching = !iscrouching
if is
crouching:
head.translation.y = CROUCHHEIGHT
else:
head.translation.y = STAND
HEIGHT
elif event is InputEventMouseButton and not notepicked:
if is
mousecaptured:
# release the mouse capture and hide the cursor
Input.set
mousemode(Input.MOUSEMODECAPTURED)
is
mousecaptured = false
note
picked = false
else:
# capture the mouse and show the cursor
Input.setmousemode(Input.MOUSEMODEVISIBLE)
ismousecaptured = true
var headrotationx = headx.rotationdegrees.x
var headrotation = head.rotationdegrees.y
rpcunreliableid(1, "updateremoteheadrotation", headrotationx, headrotation)

remote func updateheadrotation(headrotationx, headrotation):
if not is
networkmaster():
head.rotation
degrees.y = headrotation
head
x.rotationdegrees.x = headrotation_x

Godot version 3.5.1
in Engine by (16 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.