Skip to content

Commit 6b7f651

Browse files
committed
Adds TransformRandomExtensions
1 parent e63caad commit 6b7f651

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using UnityEngine;
2+
3+
namespace UnityExtended.Unity.Randomize
4+
{
5+
public static class TransformRandomExtensions
6+
{
7+
public static void RandomRotation(this Transform transform)
8+
{
9+
transform.Rotate(
10+
xAngle: Random.Range(0, 360),
11+
yAngle: Random.Range(0, 360),
12+
zAngle: Random.Range(0, 360)
13+
);
14+
}
15+
16+
public static void RandomXRotation(this Transform transform)
17+
{
18+
transform.Rotate(Random.Range(0, 360), 0, 0);
19+
}
20+
21+
public static void RandomYRotation(this Transform transform)
22+
{
23+
transform.Rotate(0, Random.Range(0, 360), 0);
24+
}
25+
26+
public static void RandomZRotation(this Transform transform)
27+
{
28+
transform.Rotate(0, 0, Random.Range(0, 360));
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)