Skip to content

Commit 4ad01a4

Browse files
committed
feat: Add Gizmos util
1 parent f486ce9 commit 4ad01a4

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Debug.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* $File: Debug.cs $
2+
* $File: JCS_Debug.cs $
33
* $Date: $
44
* $Revision: $
55
* $Creator: Jen-Chieh Shen $
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* $File: JCS_Gizmos.cs $
3+
* $Date: $
4+
* $Revision: $
5+
* $Creator: Jen-Chieh Shen $
6+
* $Notice: See LICENSE.txt for modification and distribution information
7+
* Copyright (c) 2025 by Shen, Jen-Chieh $
8+
*/
9+
using System;
10+
using UnityEngine;
11+
12+
namespace JCSUnity
13+
{
14+
/// <summary>
15+
/// Gizmos utilities.
16+
/// </summary>
17+
public static class JCS_Gizmos
18+
{
19+
/* Variables */
20+
21+
/* Setter & Getter */
22+
23+
/* Functions */
24+
25+
/// <summary>
26+
/// Execution body with in transform maxtrix.
27+
/// </summary>
28+
public static void WithTransformMatrix(Transform trans, Action body)
29+
{
30+
// Save old matrix
31+
Matrix4x4 oldMatrix = Gizmos.matrix;
32+
33+
// Apply transform's position, rotation, and scale
34+
Gizmos.matrix = Matrix4x4.TRS(trans.position, trans.rotation, trans.localScale);
35+
36+
body?.Invoke();
37+
38+
// Restore old matrix
39+
Gizmos.matrix = oldMatrix;
40+
}
41+
}
42+
}

Assets/JCSUnity/Scripts/Util/JCS_Gizmos.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JCS_Gizmos
2+
3+
Gizmos utilities.
4+
5+
## Functions
6+
7+
| Name | Description |
8+
|:--------------------|:-----------------------------------------|
9+
| WithTransformMatrix | Execution body with in transform maxtrix.|

0 commit comments

Comments
 (0)