예제 #1
0
 /// <summary>
 /// Check for a collision between a LineSegmentCollider and a CircleCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(LineSegmentCollider self, CircleCollider other)
 {
     return(Collision(other, self));
 }
예제 #2
0
 /// <summary>
 /// Check for a collision between a LineSegmentCollider and a LineSegmentCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(LineSegmentCollider self, LineSegmentCollider other)
 {
     return(GeometryUtils.AreSegmentsIntersecting(
                self.x1, self.y1, self.x2, self.y2,
                other.x1, other.y1, other.x2, other.y2));
 }
예제 #3
0
 /// <summary>
 /// Check for a collision between a LineSegmentCollider and a ParticleCollider.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="other"></param>
 public static bool Collision(LineSegmentCollider self, ParticleCollider other)
 {
     return(GeometryUtils.IsPointOnSegment(other.x, other.y, self.x1, self.y1, self.x2, self.y2));
 }
예제 #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);
 }
예제 #5
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 }));
 }
예제 #6
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);
 }