value area around an item

Good morning everyone,

I would like to know whether it is possible to surround an item in an area and to be able to declare minimum and maximum values to that area.
For example: the item is hot and the area is the heat radiation around the item.
Another example: the item is a water point and the area the percentage of moisture around the water point.

Thank you in advance for your answers

No one has an idea about this?

You mean, a gradient?

Yes, a gradient that extends around the limits of a shape, over a given length.

Custom collision shapes around area + distance to origin.

An example, please

If the shapes were spherical or even capsules, then all this would be easy peasy. However, since we are talking about custom shapes and according to the above drawing, the area width (distance between the max and min areas) is variable across the perimeter, I would personally go with discrete, instead of continous values.

For discrete values, it takes just a couple of minutes to setup everything. It’s a question of creating a static mesh component with the custom shape you want. Then add this component, as many as the zones you want to the item. And finally binding the overlap events:

](filedata/fetch?id=1807459&d=1599049558)

](filedata/fetch?id=1807460&d=1599049563)

For continous values, that would require playing with collisions, traces and all, and right now I don’t have time to play with all that. Unless the width is constant and known, which in that case, it’s quite easy. You tell me.

The widths would not be constant, imagine earth after rain for example it is wet and dry in the sun. Or the cooling of that same earth at nightfall.

Going further, a measure of time should be incorporated :slight_smile:

I’ll test it and let you know.
Thank you very much for your time.

Hello EvilCleric, all,

I come back to the subject :slight_smile:

Let’s start, if you will, with discrete values, it will certainly be easier to start
Can you give me a little more explanation, please?
As a beginner, I’m lost!

Where the “Cast to Bound” comes from ?

thank you in advance

1 - create the default shape of the boundary (make sure it has collision):

0.jpg](filedata/fetch?id=1808868&d=1599454709)

2 - create a static mesh component bp (named it for example Bound), add the shape and 2 variables (in, *out *- check step 4 for why):

](filedata/fetch?id=1808869&d=1599454756)

Also check to hide the mesh where in game and set the collisions:

12.jpg](filedata/fetch?id=1808873&d=1599455525)

3 - create the item bp and a variable Value (this will contain the current field value). The center contains the item and then add as many Bound components as areas you need (in this case only 3):

](filedata/fetch?id=1808870&d=1599454798)

4 - set the values of *in *and *out *of each Bound component. These are the values of the field inside and outside of that area:

](filedata/fetch?id=1808871&d=1599454952)

5 - bind the overlaps events for all areas to set *value *to the respective *in *or *out *values:

](filedata/fetch?id=1808872&d=1599454962)

Notes: I recommend the following to simplify and facilitate all this:

  • use the constructor of the Item BP to automate its creation - where the minimum inputs required would be the number of areas, the default meshes and scales;
  • use Get Children Component and loops to bind the events;
  • remove the *out *variable - there is no need for it.

Thank you for putting that in detail.

I have a result, but unsatisfactory :o

In my “installation” the values decrease or increase from one to the other pat (50=>5, 5=>0). I would have liked it to flow more regularly (1=>2=>3=>4=>5 …).
Moreover, entry and exit are not regular.

](filedata/fetch?id=1809222&d=1599531131)
I went through a widget, but maybe you have another solution?

I’m starting to see what’s doable with “get children,” it’s complex… :confused:

The example I gave, had 3 zones and flowed from 0=>5=>50=>100.
3 to 5 zones are usually what is used with this method, good for example to simulate an exponential growth in damage.

But if you want something more regular that has like 100 zones, then better go with continous.
But like I said, if the width between the inner and outer boundaries is constant:

1.jpg](filedata/fetch?id=1809235&d=1599534105)

and d is know then it’s easy (a simple trace and a couple of vec. ops). Otherwise, …

Here is an example using continuous values, but considering constant width.

We have 2 custom shape boundaries surrounding the item - in and out (as you can see the width aproximately the same between all the 2 boundaries, in this case around 500 units):

](filedata/fetch?id=1809253&d=1599541158)

The collisions settings are:

In boundary:

](filedata/fetch?id=1809254&d=1599540487)

Out boundary:

3.jpg](filedata/fetch?id=1809255&d=1599540493)

To get the value (considering an int between 0 and 100), we linetrace from the player to the item’s origin, which will intercept the inner boundary. And with that we determine the distance between the player and the inner boundary. Then we use this distance and the width of the area to determine the value:

](filedata/fetch?id=1809260&d=1599541591)

Result:

](filedata/fetch?id=1809261&d=1599541598)

Thank you very much for your time and your patience with me.
I owe you the truth, I made a mistake assembling the knots. I put a «Bind Évent To on Component begin Overlap» in second position instead of an «end overlap», as you can imagine it did not work very well, hence my questioning.
By fixing my mistake, everything is working perfectly.
I’m still interested in your second solution.
Obviously I don’t quite see how you do it, you talk about «trace» and this with the «break hit» function
results” or similar?

Like demonstrate in my last post, you have 2 boundaries: *IN *and OUT, with a distance *d *between them (I used d=500). Once the player crosses the *OUT *boundary, a linetrace between the player and the center is done, which intercepts the *IN *boundary. From this trace we get the distance between the player and the *IN *boundary.

1.PNG

From that, is just a question of mapping that distance with the values you want. In my previous example, I used the mapping [0,500] -> [100,0], where 100 is when you reach the item and 0 when you are out of range.

In order to understand the meaning of your sentences, I tried to find tutorials which could have explained to me the principle of “mapping”, put here I could only find tutorials telling me about the creation of terrain or so of reconfiguration of the keys and movement function, nothing that relates to what concerns us.

I am a bit too beginner to know which nodes would be useful when starting my business. This is why I ask you to be lenient towards a “newbie” and to kindly give me an example of Bleuprint so that I can glimpse the beginning of a glow that would allow me to direct myself in the darkness of my ignorance. :o

Not speaking english, i have to use a translator and the youtube one is not the best

thanks in advance :slight_smile:

Take your first pic of this thread. Let’s imagine that the green zone is a radioactive area, where its value goes linearly from 0 to 100 (max radiation level - the closest distance to the item).

1.png](filedata/fetch?id=1809486&d=1599587586)

Let the distance between those 2 points be 500 units.

Now, our goal is to determine the value of the radiation at any location between those 2 points:

](filedata/fetch?id=1809487&d=1599588524)

Basically, we need a function that given a distance 0<x<500, returns a corresponding radiation level between 100 and 0.

How do we calculate it? Two ways:

  • manually (too much extra work)
  • using the “Map Range XXX” (quickest option). From the example I gave earlier:

](filedata/fetch?id=1809488&d=1599588785) ​

If you already used progress bars widgets, then you probably already did some mapping operation, where, for example, you had to transform your health value, that goes from 0 to 100, to a value between 0 and 1. Same principle.

Ok, I’m starting to see more clearly.
A problem persists, at the end of “round” my value remains at 0.
I wonder if there might not be a variable to declare in the player, but I do not see any in your diagram.
Another thing escapes me you bring the player out of the “Out” zone, but we don’t see an entry in the “In” zone.

I have not yet had the opportunity to use a “progress bar”, I know absolutely nothing in this area, but I intend to educate myself, with your help, here and on tutorials. Know that I am progressing faster with you :wink:

Nothing to add to the player.

Are the overlaps events triggered?

Show pics of the BP, of the event graph and the viewport.

That’s up to you. You get into the Item zone, then what?

Colision In :

](filedata/fetch?id=1809682&d=1599639208)

Colision Out :

](filedata/fetch?id=1809683&d=1599639216)

Bleuprint and Graph :

](filedata/fetch?id=1809684&d=1599639224)

Viewport :

](filedata/fetch?id=1809685&d=1599639394)