0 votes

I am making a multiplayer first-person game and am trying to figure out how to make it so other players can see your body, but you can only see your hands. Does anybody know how to make the mesh instance hidden for you, but not anybody else?

Godot version 3.4.4
in Engine by (28 points)

Thankyou for everybody's help. I finally figured out a straightforward solution.

First, make a parent to all the meshes you want hidden by putting them under a spatial node. Next, make a variable for this. onready var mesh = $PlayerMesh Next, under your func _ready, add something that says mesh.visible = !is_network_master() This will make it so if you clarify that you were the network master, your mesh will be hidden for only you.

1 Answer

+1 vote

Keep in mind that this stuff is not replicated on its own. So if you hide a body in one instance, it won't be hidden in the other instances, unless you explicitly send an rpc. So whenever you spawn the player's own character, you can just hide the body and this change will be local to the players client. When you then spawn characters for other players, e.g. in _player_connected(id), you just hide the arms instead of the body.

You could also use entirely different scenes for the local player and other connected players and do the positional updates outside of those scenes.

I was going to suggest to use different render layers for that, but that probably won't scale.

by (1,519 points)

Doing the arms is easy because all you need to do is not send the arms to the server. What I can’t figure out is how to make the mesh hidden to only you, but to have it broadcast to the server. What would the lines be to do it?

What exactly do you want to broadcast to the server? Can you explain your scene setup a bit?

It’s a kinematic body with a cgmesh combiner (this has all the meshes that I want to hide) the body also has a 3d spatial called head (this contains the two cameras, hud, and all the stuff that I am content with), the body also has two collisions (a bean and cylinder), and a ground check ray cast. It is a modified version of the player from garbaj tutorials.

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.