0 votes

For updating the movement, I use rpcunreliable("setposition", globaltransform.origin) How would i use the same format to update the rotation of a character?

Godot version 3.2.3
in Engine by (21 points)

func input(event):
if is
networkmaster():
if event is InputEventMouseMotion:
head.rotate
y(deg2rad(-event.relative.x * ms))

        var x_delta = event.relative.y * ms
        if camera_x_rotation + x_delta > -90 and camera_x_rotation + x_delta < 90:
            camera.rotate_x(deg2rad(-x_delta))
            camera_x_rotation += x_delta
rpc_unreliable("_input")

It is not working because it is not updating the character rotation. What can I do to resolve it?

1 Answer

0 votes

Transforms are composed of two parts. A Vector3 called origin, representing the translation of your Spatial, and a Basis called basis, representing rotation and scale. Instead of only sending global_transform.origin, you could send the Transform directly. Either make your own function that sets the transform property on the other end, or use rset().

Note that you probably want to use transform instead of global_transform.

rpc_unreliable("set", ["transform", transform])

by (2,276 points)
edited by

Hello, thanks for responding. How would I write this in code?

I tried to put transform.origin instead but there was no difference.

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 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 webmaster@godotengine.org with your username.