forked from jbruening/unity3d-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix4x4X.cs
More file actions
35 lines (26 loc) · 799 Bytes
/
Matrix4x4X.cs
File metadata and controls
35 lines (26 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
namespace UEx
{
// ReSharper disable InconsistentNaming
/// <summary>
/// Matrix4x4 extensions
/// </summary>
public static class Matrix4x4X
// ReSharper restore InconsistentNaming
{
public static Matrix4x4 RandomMatrix(float min = 0, float max = 1)
{
var ret = new Matrix4x4();
for (int i = 0; i < 16; i++)
ret[i] = UnityEngine.Random.Range(min, max);
return ret;
}
public static Matrix4x4 Lerp(Matrix4x4 from, Matrix4x4 to, float time)
{
var ret = new Matrix4x4();
for (int i = 0; i < 16; i++)
ret[i] = Mathf.Lerp(from[i], to[i], time);
return ret;
}
}
}