How to outline characters OnMouseOver in a RTS

I have the post processing material ready

However I can’t figure out how to make a single character light up when the mouse is over them. What I’ve tried is:

1 Adding a Post Process component to the character BP

2 Create a dynamic material instance for that character in Construct and adding it to the PP component

3 Editing the Paramaters of the character on mouse over

What ends up happening is only one of the character activates the outline (usually the last one that spawned) and when it does it’s not only on that character but on every character on the map.

Outlines

I’m probably not going about it the right way, does anyone have any suggestions?

I’m assuming it’s not multiplayer?

You only need one instance of the PP. So you can have it in the level, or maybe in the game instance etc.

Trouble is, because you’ve set the meshes of all the characters as custom stencil, they will light up. Can’t recall, not at a machine rn, but can’t you just only turn on custom depth for the one you’re highlighting, while you’re highlighting them?

It is multiplayer :smile:

The custom stencil enabled all the time because the same outline material activates when they are occluded by objects.

Outline-2

The end goal is to have the outline/occlusion color be different based on friend/ally but I’ll cross that bridge when I get there

Ah, multiplayer, I have no idea, sorry… :frowning:

No problem, although I don’t think multiplayer or not is relevant because post processing stuff is always local. Unless I’m forgetting something

What about this!? :slight_smile:

Good find, this fixed my team color problem, but the original problem persists, outline only appears when hovering over the last spawned character and it activates on all characters at once

I still think you only need one PP, but you have one on each player?

I watched part 2 of the tutorial you linked and he does the same thing as I have done, he adds a PP component to his character BP

Ok, makes no sense to me then. I have to bail at that point… :smiling_face:

I got it working and here is how I did it:

Basically I made the material so that it has 6 “states”

1: Always Show Outline but show Occlusion Fill only when occluded in Ally color
2: Always Show Outline but show Occlusion Fill only when occluded in Enemy color
3: Always Show Outline but show Occlusion Fill only when occluded in Neutral color

4: Show Outline and Occlusion Fill in Ally color only when occluded
5: Show Outline and Occlusion Fill in Enemy color only when occluded
6 Show Outline and Occlusion Fill in Neutral color only when occluded

From here I determine what state the character should be using by switching the Custom Depth Stencil value. The default is anywhere from 4-6 based on team color and it goes to 1-3 on mouse over.

Only one post processing volume was required for this and I can keep Render Custom Depth on at all times.

Outline Working

@ClockworkOcean

Nice :slight_smile: Glad I didn’t have to work that out! :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.