Timothy Soon Yu Feng Timothy Soon Yu Feng - 11 months ago 54
C# Question

Creating floor indicators in top down game

I've just started on a side project game and was wondering how would you go about creating an indicator on the floor that reshapes itself base on the terrain? this is an example.

Picture Example 1

Base on this example, if a rock is inside the indicator, i want it to reshape itself so that the indicator can be seen above the rock.

Is it possible to achieve this by using shaders?

Currently I'm using raycast that sets a texture onto the mouse position, but when I hover ontop of a thin object, the indicator feels weird and doesn't reshape itself to fit the terrain.

And also if the indicator is on top of 2 objects, I want it to reshape itself onto both of that object.

Thanks for helping!

Answer Source

They are called Projectors.

You use them kind of like lights. They cast a light based on a mask onto the ground (or any object or objects) depending on the layers set to be affected.