@@ -61,31 +61,6 @@ public void Initialize()
61
61
transform . localScale = Vector3 . one ;
62
62
}
63
63
64
- private Vector2 RotateUV ( Vector2 uv , float angle )
65
- {
66
- var cos = Mathf . Cos ( angle ) ;
67
- var sin = Mathf . Sin ( angle ) ;
68
- var x = uv . x * cos - uv . y * sin ;
69
- var y = uv . x * sin + uv . y * cos ;
70
- return new Vector2 ( x , y ) ;
71
- }
72
-
73
- private Vector2 GetUV ( Vector3 point )
74
- {
75
- var radius = 80f ;
76
- var radiusHalf = radius * 0.5f ;
77
- var minPos = _position ;
78
- minPos -= new Vector3 ( radiusHalf , radiusHalf , radiusHalf ) ;
79
- var maxPos = minPos + new Vector3 ( radius , radius , radius ) ;
80
-
81
- point -= minPos ;
82
- point /= radius ;
83
-
84
- var uv = new Vector2 ( point . x - 0.5f , point . z - 0.5f ) ;
85
- uv = RotateUV ( GetUV ( uv ) , _rotation . y * Mathf . Deg2Rad ) ;
86
- uv += new Vector2 ( 0.5f , 0.5f ) ;
87
- return uv ;
88
- }
89
64
private void BuildDecalMesh ( Mesh terrainMesh )
90
65
{
91
66
_decalMesh = new Mesh ( ) ;
@@ -98,7 +73,7 @@ private void BuildDecalMesh(Mesh terrainMesh)
98
73
var radius = 80f ;
99
74
var radiusHalf = radius * 0.5f ;
100
75
var decalPositionMatrix = Matrix4x4 . Translate ( new Vector3 ( - _position . x + radiusHalf , 0f , - _position . z + radiusHalf ) ) ;
101
- var decalRotationMatrix = Matrix4x4 . Rotate ( Quaternion . Euler ( 0f , _rotation . y , 0f ) ) ;
76
+ var decalRotationMatrix = Matrix4x4 . Rotate ( Quaternion . Euler ( 0f , - _rotation . y , 0f ) ) ;
102
77
103
78
for ( var i = 0 ; i < vertices . Length ; i ++ )
104
79
{
0 commit comments