From c7748c7b9457302fd1074255dd2f670f85ad7b57 Mon Sep 17 00:00:00 2001 From: Nahuel Rocchetti Date: Sun, 4 Aug 2024 15:46:54 -0300 Subject: [PATCH 1/2] Fix decal rotation --- .../Scenes/ParticleEffects/SwarmDecal.cs | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/Assets/Scripts/OpenTS2/Scenes/ParticleEffects/SwarmDecal.cs b/Assets/Scripts/OpenTS2/Scenes/ParticleEffects/SwarmDecal.cs index 0263b388..f4b75a74 100644 --- a/Assets/Scripts/OpenTS2/Scenes/ParticleEffects/SwarmDecal.cs +++ b/Assets/Scripts/OpenTS2/Scenes/ParticleEffects/SwarmDecal.cs @@ -61,31 +61,6 @@ public void Initialize() transform.localScale = Vector3.one; } - private Vector2 RotateUV(Vector2 uv, float angle) - { - var cos = Mathf.Cos(angle); - var sin = Mathf.Sin(angle); - var x = uv.x * cos - uv.y * sin; - var y = uv.x * sin + uv.y * cos; - return new Vector2(x, y); - } - - private Vector2 GetUV(Vector3 point) - { - var radius = 80f; - var radiusHalf = radius * 0.5f; - var minPos = _position; - minPos -= new Vector3(radiusHalf, radiusHalf, radiusHalf); - var maxPos = minPos + new Vector3(radius, radius, radius); - - point -= minPos; - point /= radius; - - var uv = new Vector2(point.x - 0.5f, point.z - 0.5f); - uv = RotateUV(GetUV(uv), _rotation.y * Mathf.Deg2Rad); - uv += new Vector2(0.5f, 0.5f); - return uv; - } private void BuildDecalMesh(Mesh terrainMesh) { _decalMesh = new Mesh(); @@ -98,7 +73,7 @@ private void BuildDecalMesh(Mesh terrainMesh) var radius = 80f; var radiusHalf = radius * 0.5f; var decalPositionMatrix = Matrix4x4.Translate(new Vector3(-_position.x + radiusHalf, 0f, -_position.z + radiusHalf)); - var decalRotationMatrix = Matrix4x4.Rotate(Quaternion.Euler(0f, _rotation.y, 0f)); + var decalRotationMatrix = Matrix4x4.Rotate(Quaternion.Euler(0f, -_rotation.y, 0f)); for(var i = 0; i < vertices.Length; i++) { From 52aef0d5aa2e92c996ff695725c142fb109332da Mon Sep 17 00:00:00 2001 From: Nahuel Rocchetti Date: Sun, 4 Aug 2024 15:54:55 -0300 Subject: [PATCH 2/2] Update GraphicsSettings.asset --- ProjectSettings/GraphicsSettings.asset | 1 + 1 file changed, 1 insertion(+) diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index e108a0f5..a6405a5c 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -30,6 +30,7 @@ GraphicsSettings: m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} m_VideoShadersIncludeMode: 2 m_AlwaysIncludedShaders: + - {fileID: 4800000, guid: cd1c2fe69305d6340a8e116e63955e26, type: 3} - {fileID: 4800000, guid: 75e0683a765caef42b3b3feffe1eee77, type: 3} - {fileID: 4800000, guid: 687258d81ac22d0468c2f8b31c25f43d, type: 3} - {fileID: 4800000, guid: 4d0461340a185194c81b99c57ca9c084, type: 3}