Using the timer to switch between a boolean property

So what I am trying to do here is have an object move in one direction, but then after half a second, reverse and move in the opposite direction. I figured I could do that by setting a timer-controlled property and just switching back and forth from true and false on a repeating timer. The first part of the branch works, as it recognizes the property timeHit as true and moves forward. However, it never reverses.

I’m thinking I’m not quite understanding how to use the inverse node. I’ve also tried putting it on the ‘out’ side of the set property node, but the outcome is the same. Am I approaching this entirely wrong or am I just missing out on a detail/execution?

When doing this generally we appreciate that the move change smoothly in opposite direction … it’s the reason why I would do it like this

Then the Inverse node is here to allow you to play the “out”
when the “in” is not activated.

1 Like

Try doing this to set the bool on the timer:

image

I’m pretty sure that the inverse node will trigger its “Out” on any frame that its “In” is not triggered. This means the the Inverse node in your example will trigger the Set Property node ever frame except the ones where the timer fires. Also the set property node for “timeHit” is just setting its value it itself, without changing it, so it will never switch to false.

1 Like

Interesting approach, I will try it, thank you!

Ok, I will try this setup and report back, thank you! And I appreciate the inverse node insight, I was definitely confused by it. And whoops at the set property function, that’s what I get for blindly copy pasting nodes from another function :see_no_evil:

1 Like

Very pleased to announce that this setup for boolean switching worked swimmingly and the object now cheerfully bounces back and forth :smile:

And the neat thing about having it as an alternating boolean is I can plug in any other changes I want, such as changing the material back and forth

and then as a side note, it’s also fun to plug random numbers into the timer for erratic movement/changes

4 Likes

Did you try the “Alternate” node ?

4 Likes

I did not! Although I think that was what I may have been thinking of when I tried the inverse node. I remember watching a tutorial a while back talking about a ‘light switch’ type of node (on/off) and I think that may have been it. I will try playing with and modifying it soon, thank you! :smile:

2 Likes