public static Mesh Make(GameObject obj, SpacePoint blPos, SpacePoint tlPos, SpacePoint trPos, SpacePoint brPos) { Vector3[] vertices; int[] triangles; vertices = new Vector3[4]; var bl = 0; var tl = 1; var br = 2; var tr = 3; vertices[bl] = blPos.ToLocalSpace(obj).Position; vertices[tl] = tlPos.ToLocalSpace(obj).Position; vertices[br] = brPos.ToLocalSpace(obj).Position; vertices[tr] = trPos.ToLocalSpace(obj).Position; triangles = new int[6]; triangles[0] = bl; //BL triangles[1] = tl; //TL triangles[2] = br; //BR triangles[3] = tl; //BL triangles[4] = tr; //TL triangles[5] = br; //BR return(ToMesh(vertices, triangles)); }
public static Vector2 Delta(SpacePoint start, SpacePoint end) { var s = start.ToWorldSpace().Position; var e = end.ToWorldSpace().Position; var change = (e - s).normalized; return(new Vector2(change.x, change.y)); }