Skip to content

Commit 5afd12b

Browse files
committed
add translation to matrix
1 parent 587f52f commit 5afd12b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Runtime/Scripts/Util/Math/ZOMatrix4x4Util.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,13 @@ public static Matrix4x4 WorldTranslationRotationMatrix(this Transform t) {
4343
return Matrix4x4.TRS(t.position, t.rotation, Vector3.one);
4444
}
4545

46+
public static Matrix4x4 AddTranslation(this Matrix4x4 matrix, Vector3 translation) {
47+
matrix[0, 3] += translation.x;
48+
matrix[1, 3] += translation.y;
49+
matrix[2, 3] += translation.z;
50+
return matrix;
51+
}
52+
53+
4654
}
4755
}

0 commit comments

Comments
 (0)