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"

How to make Character model hidden?

So how can I make the character's model hidden when a button is pressed, but still cast a shadow?

Or even better, how can I just make the head part of the character model hidden when a button is presses, but still cast a shadow.


Product Version: Not Selected
more ▼

asked Jul 21 '14 at 10:03 PM in Blueprint Scripting

avatar image

3 4 7 6

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

1 answer: sort voted first

Hey Knovolt,

In your Player Controller (or wherever you are receiving input for your character), you can use the Set Hidden in Game node to toggle whether a Component is hidden during play. You could set up something like this:

alt text

This will Cast to the character Blueprint, get the component you want (in your case, your Head mesh), and set it Hidden. I'm using a Bool variable (default value as false) and setting its negative every time, so while H is pressed the mesh is hidden, and when H is released it becomes visible again.

You can decide whether an Actor or Component casts a shadow while Hidden. In this case, I found the mesh component of my character's Blueprint and scrolled down to Lighting in the Details panel. If you expand that section, you'll find Cast Hidden Shadow. Enable that, and a shadow will be cast whether it is hidden in the game or not.

alt text

Hope that helps!

Ben Halliday

more ▼

answered Jul 21 '14 at 10:24 PM

avatar image Knovolt Jul 21 '14 at 11:02 PM

Thanks. But, when I hit play and press my designated key, it works and all but after a while the shadow stops animating. It still casts the shadow but soon after it stops animating and freezes.

And when I press the "S" key to turn walk backwards, the shadow turns around, but the camera doesn't.

(Note: the aforementioned issues happen even when I uncheck the "Visible" box in "MyCharacter" defaults.)

And how do I just link it to the head, I still want my hands for example to be visible. Could this be that I didn't have mesh as target? I couldn't seem to get it up...

Here's the blueprint I got so far. I'm so very stuck with this, thank you. alt text

hiddenblueprint.png (169.6 kB)
avatar image Ben Halliday STAFF Jul 22 '14 at 03:56 PM

Hm, I'm seeing the same thing with the shadows pausing after a bit. I'll enter a bug report for that and see what the developers say.

It looks like you're setting this up in your Character Blueprint, so you can skip the Casting step. In the image above, you're casting to yourself, which is unnecessary. Instead, just call the Hidden in Game node directly off the mesh you want to hide. If you only want to hide a certain portion of the mesh, you'll need to have the mesh split into several components. If you look at the FPS template, you can see how this is done: there is a mesh for the full body and a separate mesh for just the arms. There is also a checkbox in the Rendering section of a mesh component's details for Owner No See; this is how hiding the mesh from the player is handled in multiplayer games.

Is that what you're attempting to do here? To switch from a third person to a first person perspective? I'm not exactly clear on what issue you're running into when you press S, or how you have your camera set up.

avatar image Knovolt Jul 22 '14 at 05:02 PM

Okay, I'll go look at the FPS template and see how it works. But what do I type to search for the "target mesh".

And yeah, I'm trying to do a fp to tp perspective, but the head either clips into the camera or I can see the entire head/neck when I run. But, now the shadow seems to be working fine? Maybe I had to exit/relaunch the editor?

By pressing "S", the shadow turns around and faces backwards, but the camera does not change (in first person). Shown here:


I tried having a angle limit on the yaw, and it works nice, but when I press "S" it spins the camera around abruptly. So when holding down "S" the camera spins in circles because the blueprint makes the camera spin when it goes pass the limits.

avatar image Ben Halliday STAFF Jul 22 '14 at 08:03 PM

In your video you are no longer hiding the mesh, so that's why the shadow isn't showing that bug.

You might want to open a new thread on the forums or here on AnswerHub for how to switch from third to first person and back, as there are a number of possibilities there and I'm sure the community has some answers for you. The problem you have with S turning your character around is that the controls are still set for third person, in which the character can run towards the camera rather than run backwards. You'll need to switch to a control setup more suitable for a first person perspective.

You might consider setting up a second Player Controller Class with controls similar to those you can find in the First Person template. Then you can cast to your Game Mode and set the Player Controller Class when appropriate.

Hope that helps!

avatar image Nox_A15 Sep 03 '15 at 09:30 PM

In 4.9 animation still stops when a character's visibility is turned off or when it is set as hidden in the game. Is it intended or a bug?

avatar image Ben Halliday STAFF Sep 09 '15 at 03:37 PM

Hi Nox,

Please open a new post in the Bug Reports section with as many details as you can provide and we can look into it there. Thanks!

(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