# How do i randomly rotate point instances with either 90, 180, 270 or 360 degrees?

How do i randomly rotate point instances with either 90, 180, 270 or 360 degrees?

When using attribute randomize, and choosing rotation as the attribute, I cannot achieve this result.

• Why do you want to rotate something by 360°? (360=0) Is it animated? You can calculate a random number (0,1,2,3) and multiply it by 90. Jul 12 at 14:23

You can for instance use an Attribute Randomize node set to Integer after your Point Distribute node, type in rotation as the attribute, Min value of 0 and max value of 3.

This will fill the rotation parameter of each point instance with random vectors containing integers between 0 and 3.

Afterwards, use an Attribute Vector Math node set to Multiply. Set A and Result to rotation, because we want to use the previous data to set the final rotation. Change the type of B to Vector, and set it to [0, 0, 1.5708] (or type pi/2 in the field for better precision).

What we just did with these two nodes is setup a random integer between 0 and 3 for each point instance, and use this integer to be multiplied by $$π/2$$ :

• $$0 * π /2 = 0 rad ≡ 0° ≡ 360°$$
• $$1 * π /2 = π/2 rad ≡ 90°$$
• $$2 * π /2 = π rad ≡ 180°$$
• $$3 * π /2 = 3π/2 rad ≡ 270°$$

Result:

Note : We are doing it that way because if you just set the Attribute Randomize node to a minimum of 0 and maximum of 3π/2 (270°), it would possibly randomly generate all the possible rational numbers between 0 and 3π/2, and not numbers at fixed intervals.

If you wanted to do it that way, you could use this setup with the Vector Math node set to Snap to the closest increment of $$(0, 0, pi/2)$$.

• Ah, π does the trick. And there is a node that works as a random number generator. Good to know :) Jul 12 at 14:39
• Out of interest can this be done via align to vectors (0, 1), (1, 0), (0, -1), (-1, 0) Jul 12 at 14:43
• @batFINGER I wouldn't know how to do that efficiently in GN... Jul 12 at 15:10