Xpresso switch to pass different values?


#1

Hello, I am trying to find a node or work flow, I thought it was a switch node but I can’t seem to find it or the combination of nodes to use. Basically if my object is at a Z Axis position of 0, I need to pass a value of 1. If it is not 0, then I need to pass the value of the Z-axis.

Logic operators are 1 and 0 and I use a Compare node with a Constant node set to 0 and the z axis of of the object. When they are both 0 value, it returns a 1, else a 0. I am trying to solve a divide by 0 issue.

So basically, if the values are same as 0, return a value 1, else return the x value from the object. I am not sure what switch to use to control this with Xpresso.

Thanks!


#2

Were you thinking of the condition node ? 0 passes input 0, 1 passes input 1 etc

condition


#3

Hi Jedi949, thanks for the quick reply. You almost nailed it. The very last node in the chain is the result node that will have the result of 0 or 1 due to the condition. But the result that I need it to pass say 1 or the value from the cube Z position. Example would be 0 or 89.54 (not 1,but the z value of the cube).

Some more detail. I am rigging a car. As I move the z position forward I rigged the tires to turn. But I also want to rig the rotation of the body. So if you move faster off the start the body will lift more. I am using a memory node and distance node to measure the distance between 2 frames. I am using a math node to reduce the effect of the rotation of the body but when the truck is at position 0 I am getting a math error since you can’t divide by 0. So if the divide by value is 0, I want to switch it to a value of 1 to avoid the error. I might have totally confused you with this. But thanks for your help.


#4

I figured it out. The truck now rocks back and forth as it accelerates and decelerates. Thanks.