Improve Gizmos

This commit is contained in:
Timo Eberl 2024-09-29 22:06:13 +02:00
parent 534f4367a9
commit 93fc3e5da1
Signed by: Timo
SSH Key Fingerprint: SHA256:swVjhbVzKCLQZNtwPqMEmtOUG3FTydzVrpIKpUZYTQw

View File

@ -61,7 +61,7 @@ public class GrassField : MonoBehaviour {
var camPos = cam.transform.position - transform.position; // cam position relative to grass field
if (ignoreHeightForLOD) {
camPos.y = 0; // ignore height
camPos.y = 0;
}
var chunkSize = ((float)size) / numChunks;
@ -193,10 +193,14 @@ public class GrassField : MonoBehaviour {
var cam = Camera.main;
if (!cam) return;
var center = cam.transform.position;
var oldMatrix = Gizmos.matrix;
if (ignoreHeightForLOD) {
center.y = 0f;
center.y = 0.01f;
// draw a circle instead of a sphere
Gizmos.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1f, 0.001f, 1f));
}
Gizmos.color = new Color(1.0f, 0.0f, 1f, 2f);
Gizmos.DrawWireSphere(center, 7.5f);
Gizmos.matrix = oldMatrix;
}
}