/// <summary> /// Returns the hit line polygons for the surface. /// </summary> private IEnumerable <HitObject> GenerateLinePolys(RenderVertex2D pv1, Vertex2D pv2, EventProxy events, Table.Table table) { var linePolys = new List <HitObject>(); var bottom = _data.HeightBottom + table.TableHeight; var top = _data.HeightTop + table.TableHeight; if (!pv1.IsSlingshot) { linePolys.Add(new LineSeg(pv1, pv2, bottom, top, ItemType.Surface)); } else { var slingLine = new LineSegSlingshot(_data, pv1, pv2, bottom, top, ItemType.Surface) { Force = _data.SlingshotForce, Obj = events, FireEvents = true, Threshold = _data.Threshold }; // slingshots always have hit events linePolys.Add(slingLine); LineSling.Add(slingLine); } if (_data.HeightBottom != 0) { // add lower edge as a line linePolys.Add(new HitLine3D(new Vertex3D(pv1.X, pv1.Y, bottom), new Vertex3D(pv2.X, pv2.Y, bottom), ItemType.Surface)); } // add upper edge as a line linePolys.Add(new HitLine3D(new Vertex3D(pv1.X, pv1.Y, top), new Vertex3D(pv2.X, pv2.Y, top), ItemType.Surface)); // create vertical joint between the two line segments linePolys.Add(new HitLineZ(pv1, bottom, top, ItemType.Surface)); // add upper and lower end points of line if (_data.HeightBottom != 0) { linePolys.Add(new HitPoint(new Vertex3D(pv1.X, pv1.Y, bottom), ItemType.Surface)); } linePolys.Add(new HitPoint(new Vertex3D(pv1.X, pv1.Y, top), ItemType.Surface)); return(linePolys.ToArray()); }
public static void Create(BlobBuilder builder, LineSegSlingshot src, ref BlobPtr <Collider> dest) { ref var linePtr = ref UnsafeUtility.As <BlobPtr <Collider>, BlobPtr <LineSlingshotCollider> >(ref dest);