0
$\begingroup$

With Geometry Nodes I move the rotation angle Z of an object with a function.

And I need to know if the angle of rotation Z is nearly to zero before applying the new value in the node 'Transform'.

Depending on the angle I want to apply 'function 1' or 'function 2' to the rotation angle in the node 'transform'.

enter image description here

How can I retrieve the rotation angle Z to compare it directly in 'Compare Rotation Z'?

Thanks again

$\endgroup$
6
  • $\begingroup$ That depends on how you implemented the rotation on Z. Since it seems you are doing some kind of calculation with this function you somehow have to get the result from it to plug it into some rotation node to make the object rotate...? So if you output the result somewhere, you can use this to compare it? If not, where is the problem with that? $\endgroup$ Mar 6, 2023 at 9:53
  • $\begingroup$ I don't really understand what the problem is. Your function gives you a float value, that you want to compare to 0. So do that - connect the output of the function to Compare or Math node and enter the second value of 0. You can connect the same output to multiple inputs. Example $\endgroup$ Mar 6, 2023 at 12:00
  • $\begingroup$ Okay, I see why there might be a problem if I understand the question correctly. But if I do then this makes no real sense at first glance. As I understand it, you want to know the Z rotation which is plugged into the Transform node and compare it to 0. But the result of the comparison should drive the switch as to which function will provide the Z value - this produces a circular reference error because you have a closed loop. Let's say function 1 gives 0, and function 2 gives 1. $\endgroup$ Mar 6, 2023 at 12:20
  • $\begingroup$ If the output of the switch and therefore the Z rotation would come from function 1, the angle would be 0, then the compare node would be true and switch to function 2, but then the angle would be 1, so the compare node results in false and switching back to function 1. This does not work, because the result of the switch depends on the condition of the compare node which depends on the result of the switch. This is nonsense. $\endgroup$ Mar 6, 2023 at 12:25
  • $\begingroup$ So I guess what you really want to do is comparing the result of function 1 and 2 against 0, and if any of them is close to 0, you want the switch to use the value of the other function to be used for the Z rotation. Then you only have to compare the float value of a function to 0 and switch between both functions accordingly. But the way how to set this up depends a lot on what you want to switch to if a) both are close to 0 or b) none of them are 0. Is the value of function 1 or 2 preferred over the other? $\endgroup$ Mar 6, 2023 at 12:48

1 Answer 1

1
$\begingroup$

There is this Compare node that you can use to compare values in Geometry Nodes. It's unclear, what exactly your situation is since you have not provided much context, but that's the node if you need to compare stuff.

enter image description here

You can use Separate XYZ node(Shift+A -> Vector -> Separate XYZ in Geometry Node Editor) to split your rotation vector into parts and only compare the Z value to 0. You would need to set Compare node to Float input mode then.

Math node(Utilities -> Math) also has Compare mode, so that will work as well. You have Epsilon input in both to specify the precision for the comparison.

$\endgroup$
3
  • $\begingroup$ Thanks Martynas, I reformulated the question to explain me. $\endgroup$ Mar 6, 2023 at 10:55
  • $\begingroup$ @PepAndorra, I see no edits for the question. $\endgroup$ Mar 6, 2023 at 10:57
  • $\begingroup$ Sorry for the delay :( $\endgroup$ Mar 6, 2023 at 11:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .