Jump to content
Sign in to follow this  
anicg

every frame the switch node chooses randomly and input

Recommended Posts

How to get the switch node to choose randomly from its inputs every frame?

Share this post


Link to post
Share on other sites

Use the fit function like this...

This will give you a random switch between 0-3. Notice the -1 count on the maximum number. Set the maximum fit number to the number of inputs.

fit01(rand($F),0,4)

 

  • Like 1

Share this post


Link to post
Share on other sites

Just to add to what Atom said, you can use the opninputs() expression to return the number of inputs currently connected to the switch node, like so:

fit01(rand($F),0,opninputs(".")-1)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×