-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomShape.cs
More file actions
41 lines (33 loc) · 872 Bytes
/
CustomShape.cs
File metadata and controls
41 lines (33 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
public class CustomShape : BaseMeshEffect
{
public int spaceValue = 0;
public override void ModifyMesh(VertexHelper vh)
{
if (!IsActive())
return;
List<UIVertex> verts = new List<UIVertex>();
vh.GetUIVertexStream(verts);
vh.Clear();
var a1 = verts[0];
var a2 = verts[1];
var a3 = verts[2];
var b1 = verts[3];
var b2 = verts[4];
var b3 = verts[5];
Matrix4x4 move = Matrix4x4.TRS(new Vector3(0, spaceValue, 0), Quaternion.identity, Vector3.one);
a3.position = move.MultiplyPoint(a3.position);
b1.position = move.MultiplyPoint(b1.position);
b2.position = move.MultiplyPoint(b2.position);
vh.AddVert(a1);
vh.AddVert(a2);
vh.AddVert(a3);
vh.AddVert(b1);
vh.AddVert(b2);
vh.AddVert(b3);
vh.AddTriangle(0, 1, 2);
vh.AddTriangle(3, 4, 5);
}
}