x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Show/Hide Meshes Based on

I am making a Multiplayer game. The perspective is in first person, and I am using a mixture between 3rd person meshes an 1st person ones. Each player has 2 meshes, a first person one and third person one, each player should be able to see their own First person mesh, and everyone else 3rd person mesh, and they shouldn't be able to see their own 3rd person mesh, or anyone else's 1st person mesh. This is to achieve better readability, and to not have personal meshes getting in the way of the player controlling it. This is how it works in Overwatch. So that might be a good point of reference. So how do I hide meshes from specific camera, but not from everyone else?

Product Version: UE 4.19
Tags:
more ▼

asked Feb 09 '19 at 04:46 PM in Blueprint Scripting

avatar image

Raxs_Slayer
173 8 16 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Use IsLocalController node. True means the pawn is owned by the controller and this is where you hide ThirdPerson and unhide FirstPerson. If False, hide FirstPerson and unhide ThirdPerson because the pawn is not owned by the controller.

Alternatively, if available, you can use SetOwnerNoSee and SetOnlyOwnerSee nodes. Use what you think is more readable or whatever you prefer.

more ▼

answered Feb 09 '19 at 05:47 PM

avatar image

Chyros
1.2k 8 4 8

avatar image Raxs_Slayer Feb 09 '19 at 05:52 PM

Hi, sorry I'm not really familiar with this, so would you mind expanding a bit more? I found the node but it just gives a boolean output, so what do I do with that, and what methods should I use to then hide/show the meshes?

avatar image Chyros Feb 09 '19 at 05:57 PM

For showing/hiding meshes, use SetVisibility.

IsLocalController

  • True = FirstPersonMesh -> SetVisibility = check New Visibility

  • True = 3rdPersonMesh -> SetVisibility = unheck New Visibility

  • False = FirstPersonMesh -> SetVisibility = uncheck New Visibility

  • False = 3rdPersonMesh -> SetVisibility = check New Visibility

avatar image Raxs_Slayer Feb 09 '19 at 06:00 PM

Okay, so if a Mesh is "Owned" by a controller, enabling its visibility wont do so for other players?

avatar image Chyros Feb 09 '19 at 06:06 PM

Owned by a "local" controller. Yes. It will be true if the Pawn is yours and false if not.

avatar image Raxs_Slayer Feb 09 '19 at 06:07 PM

Great, thanks. It's implemented now. Monday is my next chance to test this properly on the servers, I'll double back and accept your answer if it all worked.

avatar image Chyros Feb 09 '19 at 06:12 PM

You're welcome. Im not sure if you are aware, but you can test multiplayer locally using UE4 multiplayer test feature. Should save you some time.

avatar image Raxs_Slayer Feb 09 '19 at 06:14 PM

Wow! This saves me a lot of backache. I can't believe I didn't find out about this sooner! Thank you very much.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question