Search Unity

Question How to use GetAttribute: Position with Compare Nodes

Discussion in 'Visual Effect Graph' started by Livealot, May 12, 2021.

  1. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Are there proper (and improper) uses of GetAttribute : Position and the Compare Nodes?

    As I experiment I am getting unexpected behavior. Some combinations are always true, some are never true, some are true when they seem they should be false, and vice versa. It makes me feel like I'm missing something else. "Or" maybe I don't understand the "Or" node.

    ComparePositionExamples.JPG

    My original goal was to do something with just the particles on the "left" of the system, or just the "right". Or the edges, ala particle position < 0.2 || particle position > 0.8

    I also got very different results if I used oldPosition instead of position.

    And if I set up the Compare nodes to overlap (x < 0.5 || x > -0.5), I would still get the False result of the Branch, where I expected it to always be True.

    observed weirdness == lack of understanding
     
  2. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    One issue I can repro is that toggling the Compare Condition does not take effect until the input connection is broken and then re-established. For example, if your condition is "Less", switching it to "Greater" does not give the opposite result immediately.