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"

How do you handle visibilty in a TOP-DOWN Game?

Hello,

I have been trying arroung with the top-down template a bit and tried to figure out a way to handle the visibility of objects, that hide you character when you walk behind them. Imagine you are in a little town with houses which you can enter. Now in order to see your charcter you need to hide everything that is hiding it, like wall, ceilings and maybe even props.

Here is what i have tried so far:

Use a material parameter collection to store the position of the character and make stuff that occludes him invisible. However, this approach doesn't look very good, thats why I threw it out of the window.

My second approach is, to make everything part of a special blueprint type, that has events you can trigger, which then will hide / show the mesh by settings its visibilty. This works, but i have some problems:

How can i determine wether a BP should be triggered to be (in)visible? I tried using rays. The problem here is. that if you use Small modular assets for walls, it will only hide the pieces that actually occlude the player character. I want it to hide whole walls, that might hide not only the character, but also important parts of the room. The effect i would like to achieve is like in the game "The Sims" (Screenshot: http://7games7.com/wp-content/uploads/2014/05/Sims3AP.jpg) As you can see here, all the bottom walls + the ceiling of the room are hidden. I wonder how it is determined which walls to show and which not, based on camera and character position

Product Version: Not Selected
Tags:
more ▼

asked Jun 13 '14 at 06:30 AM in Using UE4

avatar image

Brainshack
103 20 26 48

avatar image Brainshack Jun 13 '14 at 06:36 AM

What i also forgot:

Is there a way to make a mesh invisible but keep casting the same shadows at it did before? Also, cann i somehow change a meshs collision channel at runtime, so it wont interfere with the mousclick traces that the playercontroller makes when it is not visible?

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

1 answer: sort voted first

Hey Brainshack,

You can do a Multi Line Trace by Channel to hide Actors between the camera and the character, doing something like this:

alt text

But if you're looking to do something similar to what's shown in that image, you might be better off using a Trigger Volume around your building. When the character enters the volume, you Hide the specific walls you want (looks like bottom and left walls in that image) and ceiling, and leave all other actors visible.

If you are using static lighting, shadows will remain when actors are hidden. Dynamic shadows will not remain. When an Actor is hidden, you it won't be picked up by your mouse clicks.

Hope that helps!

Ben Halliday

hideactors.png (196.7 kB)
more ▼

answered Jun 13 '14 at 03:00 PM

avatar image LEIT Apr 01 '15 at 04:37 AM

from the four loop you have a toggle hidden array. how did you get that? Im using the top down template and i cant hide the cubes when i walk behind them. and thoughts?

avatar image Ben Halliday STAFF Apr 01 '15 at 02:31 PM

Hi LEIT,

That's just a variable of type Actor set as an array. We're using it to make a list of Actors hit by the Line Trace and hiding them all, then unhiding them when the Line Trace is done.

This isn't a perfect setup, though; in effect, this will hide all Actors the character runs behind and they will all remain hidden until the character isn't behind anything. That's probably not what you want, and you'd need to implement a way of unhiding an Actor once the Line Trace isn't hitting it in particular. That's a bit more complex, but this is this setup is a good way to start.

avatar image Raziєl Jul 16 '15 at 04:37 PM

I have the same needs. Casting a trace as Ben Halliday said you can hide meshes. and as described here you can cast the shadows. so, the solution is:

  • Make a trace from Camera to Pawn

  • Store the meshes in an array

  • Toggle the visibility

  • This meshes must be setted as "cast hidden shadows" in details pane or by blueprint

(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