Author Topic: How do you properly set and get a variable in a FX map?  (Read 235 times)

I have an FX map where I want to take the Offset Y value and use it to scale uniformly width and height.

I made a function for the Pattern Offset that is:

Code: [Select]
[ Float ] -----------|
                     } [Vector 2]
[ Float ] ->[Random]-|


Then I attached a Set node to the Random node:
Code: [Select]
[ Float ] -----------|
                     } [Vector 2]
[ Float ] ->[Random]-|
                     |->[Set]
I named the variable "PositonY"

Then in the Pattern Size I called the Variable to use it as the size:
Code: [Select]
[Get Float]-->{[Vector 2]
That caused my pattern to vanish.  Since there isn't any kind of output log, I can't tell what value it is getting, but I assume null which would set it to zero.

If I do this:
Code: [Select]
[Float]------
             |->[Add]->{[Vector 2]
[Get Float]--
By adding 1 to it, the pattern appears to draw at actual size.  I changed the Add to Multiply the pattern vanishes (which would make sense as anything times zero would be zero).

So how am I supposed to pass a variable from the position to use in the size?  Is there a way to output debug log so I know what values it is generating? 

Quote
Then in the Pattern Size I called the Variable to use it as the size:
Code: [Select]

[Get Float]-->{[Vector 2]

That caused my pattern to vanish.  Since there isn't any kind of output log, I can't tell what value it is getting, but I assume null which would set it to zero.

Just to make sure it's not a simple mistake on your end, did you mean to type Get Float2 here?

It might be.  Why would I want a GetFloat2?

I'm only grabbing the Y offset value, not the X.  So wouldn't that be a single variable?

Here is my exact setup:

This is the Pattern Offset (I've kept it as simple as possible)



This is the Pattern Size


The offset runs between -.8 and 0 randomly.  So if I add 1 to it, I should get sizes ranging from .2 to 1.  Right now I get a size of 1 (I think I can't inspect what values are being output, but visually it matches what a size of 1 is, if I bypass the addition node

Ok I solved it, but I don't know why I solved it.

If I change my graph where I set the value so that I then output the value from the Random node into the Vector 2 it works.




I misunderstood your text chart when I first looked at it. Thought you were setting a float2, my mistake.

Your first version didn't work because the set variable never fired as it wasn't apart of the main node path.

I only today understood that the equations run from Right to Left in how they are evaluated.  I know this is months late, but I didn't get it initially.  Set as root, woosh right over my head what that was implying.