//5.2.1p1 public void ModifyMesh(VertexHelper vh) { if (enabled && gameObject.activeInHierarchy) { var verts = new List <UIVertex>(); var glyph = new GlyphQuad(); vh.GetUIVertexStream(verts); vh.Dispose(); for (int c = 0; c < Text.text.Length; c++) { glyph.LoadTris(verts, c * 6); float xDistance = AbsolutePosition + glyph.Rect.center.x; float tf = AbsoluteToRelative(xDistance); Vector3 pos = this.GetInterpolatedSourcePosition(tf); Vector3 tan = this.GetTangent(tf); var off = pos - Rect.localPosition - glyph.Center; // position offset to spline glyph.Transpose(new Vector3(0, glyph.Center.y, 0)); // shift to match baseline // Rotate, then offset to real position glyph.Rotate(Quaternion.AngleAxis(Mathf.Atan2(tan.x, -tan.y) * Mathf.Rad2Deg - 90, Vector3.forward)); glyph.Transpose(off); glyph.Save(vh); } } }
//5.2.1p1 public void ModifyMesh(VertexHelper vh) { if (enabled && gameObject.activeInHierarchy) { var verts = new List<UIVertex>(); var glyph = new GlyphQuad(); vh.GetUIVertexStream(verts); vh.Dispose(); for (int c = 0; c < Text.text.Length; c++) { glyph.LoadTris(verts, c * 6); float xDistance = AbsolutePosition + glyph.Rect.center.x; float tf = AbsoluteToRelative(xDistance); Vector3 pos = this.GetInterpolatedSourcePosition(tf); Vector3 tan = this.GetTangent(tf); var off = pos - Rect.localPosition - glyph.Center; // position offset to spline glyph.Transpose(new Vector3(0, glyph.Center.y, 0)); // shift to match baseline // Rotate, then offset to real position glyph.Rotate(Quaternion.AngleAxis(Mathf.Atan2(tan.x, -tan.y) * Mathf.Rad2Deg - 90, Vector3.forward)); glyph.Transpose(off); glyph.Save(vh); } } }