Ejemplo n.º 1
0
 /// <summary>
 /// Check for a collision between a ParticleCollider and a LineSegmentCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(ParticleCollider self, LineSegmentCollider other)
 {
     return Collision(other, self);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Check for a collision between a RectCollider and a LineSegmentCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(RectCollider self, LineSegmentCollider other)
 {
     return GeometryUtils.SeparatingAxisTheorem(self.Corners, new Vector2[] { other.Start, other.End });
 }
Ejemplo n.º 3
0
 public static bool Collision(CircleCollider self, LineSegmentCollider other)
 {
     return GeometryUtils.CircleToSegmentPOI(
         self.x, self.y, self.radius, other.x1, other.y1, other.x2, other.y2).Length > 0;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Check for a collision between a RayCollider and a LineSegmentCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(RayCollider self, LineSegmentCollider other)
 {
     return GeometryUtils.RayToSegmentPOI(
         self.x1, self.y1, self.x2, self.y1,
         other.x1, other.y1, other.x2, other.y2).HasValue;
 }