/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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 })); }
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); }