controlling a StaticSwitch with a Float/Scalar/Constant 1 in a Material

Hey Guys, i want to control a StaticSwitch with a Float…
currently iam trying to do this with a IF Node.

but i get an errors
Error [SM5] (Node If) Attempting to perform arithmetic on non-numeric types: static bool static bool
Error [SM5] (Node If) Cannot force a cast between non-numeric types.

i want to control the switch out of the cascade editor via the dynamic parameter. so it have to be a float.
is there a way to convert a float to a bool ??

Hey DarknesZ -

Your big problem is going to be getting the Switch to function at all. Despite its tag in the Material Editor, it is actually known as a Static Switch because it will only exist at compile time and not at runtime. So even if it were possible to pass a Dynamic Parameter into the Switch you would not be able to change the value in Cascade.

However there is an easy replacement, use a LERP. You would just need to make sure that Cascade only every receives a hard 0 or hard 1 and you would not see the fade from one to another. In this case simple plug the Dynamic Parameter directly into the LERP’s alpha.

Thank You

Eric Ketchum

1 Like